-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16 from bjherger/example
Examples
- Loading branch information
Showing
5 changed files
with
171 additions
and
1 deletion.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import logging | ||
|
||
from keras import Model | ||
from keras.layers import Dense | ||
|
||
from keras_pandas.Automater import Automater | ||
from keras_pandas.lib import load_mushrooms, load_titanic | ||
|
||
|
||
def main(): | ||
logging.getLogger().setLevel(logging.DEBUG) | ||
|
||
observations = load_mushrooms() | ||
|
||
# Transform the data set, using keras_pandas | ||
auto = Automater(categorical_vars=observations.columns, response_var='class') | ||
X, y = auto.fit_transform(observations) | ||
|
||
# Create model | ||
x = auto.input_nub | ||
x = Dense(30)(x) | ||
x = auto.output_nub(x) | ||
|
||
model = Model(inputs=auto.input_layers, outputs=x) | ||
model.compile(optimizer='Adam', loss='sparse_categorical_crossentropy', metrics=['accuracy']) | ||
|
||
# Train model | ||
model.fit(X, y, epochs=10, validation_split=.5) | ||
|
||
pass | ||
|
||
if __name__ == '__main__': | ||
main() |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import logging | ||
|
||
from keras import Model | ||
from keras.layers import Dense | ||
|
||
from keras_pandas.Automater import Automater | ||
from keras_pandas.lib import load_mushrooms, load_titanic | ||
|
||
|
||
def main(): | ||
logging.getLogger().setLevel(logging.DEBUG) | ||
|
||
observations = load_titanic() | ||
|
||
# Transform the data set, using keras_pandas | ||
categorical_vars = ['pclass', 'sex', 'survived'] | ||
numerical_vars = ['age', 'siblings_spouses_aboard', 'parents_children_aboard', 'fare'] | ||
|
||
auto = Automater(categorical_vars=categorical_vars, numerical_vars=numerical_vars, response_var='survived') | ||
X, y = auto.fit_transform(observations) | ||
|
||
# Create model | ||
x = auto.input_nub | ||
x = Dense(30)(x) | ||
x = auto.output_nub(x) | ||
|
||
model = Model(inputs=auto.input_layers, outputs=x) | ||
model.compile(optimizer='Adam', loss='sparse_categorical_crossentropy', metrics=['accuracy']) | ||
|
||
# Train model | ||
model.fit(X, y, epochs=10, validation_split=.5) | ||
|
||
pass | ||
|
||
if __name__ == '__main__': | ||
main() |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,44 @@ | ||
absl-py==0.2.0 | ||
astor==0.6.2 | ||
attrs==17.4.0 | ||
backports.weakref==1.0.post1 | ||
bleach==1.5.0 | ||
certifi==2018.4.16 | ||
chardet==3.0.4 | ||
click==6.7 | ||
enum34==1.1.6 | ||
Flask==0.12.2 | ||
funcsigs==1.0.2 | ||
futures==3.2.0 | ||
gast==0.2.0 | ||
grpcio==1.11.0 | ||
h5py==2.7.1 | ||
html5lib==0.9999999 | ||
idna==2.6 | ||
itsdangerous==0.24 | ||
Jinja2==2.10 | ||
Keras==2.1.5 | ||
Markdown==2.6.11 | ||
MarkupSafe==1.0 | ||
mock==2.0.0 | ||
more-itertools==4.1.0 | ||
numpy==1.14.2 | ||
pandas==0.22.0 | ||
pbr==4.0.2 | ||
pluggy==0.6.0 | ||
protobuf==3.5.2.post1 | ||
py==1.5.3 | ||
python-dateutil==2.7.2 | ||
pytz==2018.4 | ||
PyYAML==3.12 | ||
requests==2.18.4 | ||
scikit-learn==0.19.1 | ||
scipy==1.0.1 | ||
six==1.11.0 | ||
sklearn==0.0 | ||
sklearn-pandas==1.6.0 | ||
tensorboard==1.7.0 | ||
tensorflow==1.7.0 | ||
termcolor==1.1.0 | ||
urllib3==1.22 | ||
Werkzeug==0.14.1 |