Field | Value |
---|---|
Project Title | Raster Awareness in PySAL |
Project Link | https://summerofcode.withgoogle.com/projects/#5775104799145984 |
Organization | NumFOCUS (Sub-Org: PySAL) |
Mentors | Stefanie Lumnitz, Dani Arribas-Bel, [ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from keras.models import Sequential | |
from keras.layers import Dense | |
from keras.utils import to_categorical | |
model = Sequential() | |
model.add(Dense(32, input_dim=5, activation="relu")) | |
model.add(Dense(32, activation="relu")) | |
model.add(Dense(2, activation="sigmoid")) | |
model.compile(loss='binary_crossentropy', optimizer='adam', metrics=['accuracy',precision_m, recall_m]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from sklearn.ensemble import RandomForestClassifier | |
clf = RandomForestClassifier(n_estimators=100, criterion = "gini") | |
clf = clf.fit(train_x, train_y) | |
pred_y = clf.predict(test_x) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from sklearn.linear_model import Perceptron | |
clf = Perceptron(tol=1e-3) | |
clf = clf.fit(train_x, train_y) | |
pred_y = clf.predict(test_x) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from sklearn.linear_model import LogisticRegression | |
clf = LogisticRegression(solver='lbfgs') | |
clf = clf.fit(train_x, train_y) | |
pred_y = clf.predict(test_x) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from sklearn import tree | |
clf = tree.DecisionTreeClassifier() | |
clf = clf.fit(train_x, train_y) | |
pred_y = clf.predict(test_x) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from sklearn.model_selection import train_test_split | |
from sklearn import metrics | |
train_x, test_x, train_y, test_y = train_test_split( X.values, Y.values, test_size=0.3) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
x = X.values | |
mmscaler = preprocessing.MinMaxScaler() | |
x_norm = mmscaler.fit_transform(x) | |
X = pd.DataFrame(x_norm) | |
print(X.head()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from sklearn.preprocessing import LabelEncoder | |
le = LabelEncoder() | |
X['Delivery Number']= le.fit_transform(X['Delivery Number']) | |
X['Delivery Time']= le.fit_transform(X['Delivery Time']) | |
X['Blood Pressure']= le.fit_transform(X['Blood Pressure']) | |
X['Heart Problem']= le.fit_transform(X['Heart Problem']) | |
Y['Caesarian']= le.fit_transform(Y['Caesarian']) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
X = df.iloc[:,:5] | |
Y = df.iloc[:,-1:] | |
print(X.head(),"\n\n",Y.head()) |
NewerOlder