-
Notifications
You must be signed in to change notification settings - Fork 3
/
playground.py
46 lines (32 loc) · 1.09 KB
/
playground.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#
# playground.py
# 4/22/16
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from sklearn import neighbors
from sklearn import preprocessing, datasets
from sklearn.metrics import mean_squared_error
import math
import csv
dataFile = pd.read_csv("traindata.csv", header=0)
# CFA is our Y
cfa = dataFile['Correct First Attempt'].ravel(order='C')
# Student ID and Step ID will be our X
studentId = dataFile['Anon Student Id'].ravel(order='C')
stepName = dataFile['Step Name'].ravel(order='C')
# Generate label encoders
le_studentId = preprocessing.LabelEncoder()
le_stepName = preprocessing.LabelEncoder()
# Encode student id and step name values
encoded_studentId = le_studentId.fit_transform(studentId)
encoded_stepName = le_stepName.fit_transform(stepName)
# Plot input data points
# plt.scatter(cfa, encoded_studentId, marker='o', c='b', label='Training data')
plt.title("Profit With Respect to Population")
plt.xlabel("Population")
plt.ylabel("Profit")
# Plot the linear regression
# plt.plot(studentId, cfa, c='r', label='Current hypothesis')
plt.legend(loc=4)
# plt.show()