Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
74 additions
and
4 deletions.
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,47 @@ | ||
import pandas as pd | ||
import numpy as np | ||
from supervised.automl import AutoML | ||
import os | ||
|
||
from sklearn.metrics import accuracy_score | ||
|
||
""" | ||
df = pd.read_csv("tests/data/Titanic/train.csv") | ||
X = df[df.columns[2:]] | ||
y = df["Survived"] | ||
automl = AutoML(mode="Explain") | ||
automl.fit(X, y) | ||
pred = automl.predict(X) | ||
print("Train accuracy", accuracy_score(y, pred)) | ||
test = pd.read_csv("tests/data/Titanic/test_with_Survived.csv") | ||
pred = automl.predict(test) | ||
print("Test accuracy", accuracy_score(test["Survived"], pred)) | ||
""" | ||
|
||
import pandas as pd | ||
import numpy as np | ||
from sklearn.metrics import accuracy_score | ||
from supervised import AutoML | ||
|
||
train = pd.read_csv( | ||
"https://raw.githubusercontent.com/pplonski/datasets-for-start/master/Titanic/train.csv" | ||
) | ||
print(train.head()) | ||
|
||
X = train[train.columns[2:]] | ||
y = train["Survived"] | ||
|
||
# automl = AutoML(mode="Compete") # default mode is Explain | ||
automl = AutoML(total_time_limit=120) # default mode is Explain | ||
|
||
automl.fit(X, y) | ||
|
||
test = pd.read_csv( | ||
"https://raw.githubusercontent.com/pplonski/datasets-for-start/master/Titanic/test_with_Survived.csv" | ||
) | ||
predictions = automl.predict(test) | ||
print(predictions) | ||
print(f"Accuracy: {accuracy_score(test['Survived'], predictions)*100.0:.2f}%") |
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,11 @@ | ||
from supervised import AutoML | ||
import pandas as pd | ||
from sklearn.metrics import accuracy_score | ||
|
||
test = pd.read_csv( | ||
"https://raw.githubusercontent.com/pplonski/datasets-for-start/master/Titanic/test_with_Survived.csv" | ||
) | ||
|
||
automl = AutoML(results_path="AutoML_1") | ||
p=automl.predict(test,"Ensemble") | ||
print(f"Accuracy: {accuracy_score(test['Survived'], p)*100.0:.2f}%") |
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