Awesome
pyDD: python binding for DeepDetect
TO DO:
- Support other DeepDetect connectors:
image
,csv
,text
Installation
- Install DeepDetect (instruction here):
- Install pyDD:
pip install git+https://github.com/ArdalanM/pyDD.git
Examples
Make sure DeepDetect is up and running:
./main/dede
- Classification from array:
from pydd.solver import GenericSolver
from pydd.models import MLP
from pydd.connectors import ArrayConnector
from sklearn import datasets, metrics, model_selection, preprocessing
# create dataset
n_classes = 10
X, y = datasets.load_digits(n_class=n_classes, return_X_y=True)
X = preprocessing.StandardScaler().fit_transform(X)
xtr, xte, ytr, yte = model_selection.train_test_split(X, y, test_size=0.2)
# create connector
train_data, test_data = ArrayConnector(xtr, ytr), ArrayConnector(xte, yte)
# create model
clf = MLP(port=8085, nclasses=n_classes, gpu=False)
solver = GenericSolver(iterations=10000, solver_type="SGD", base_lr=0.01, gamma=0.1, stepsize=30, momentum=0.9)
logs = clf.fit(train_data, validation_data=[test_data], solver=solver)
yte_pred = clf.predict(test_data)
report = metrics.classification_report(yte, yte_pred)
- Classification from svm:
from pydd.solver import GenericSolver
from pydd.models import MLP
from pydd.connectors import SVMConnector
# create connector
n_classes = 10
train_data = SVMConnector(path="x_train.svm"),
test_data = SVMConnector(path="x_test.svm")
clf = MLP(port=8085, nclasses=n_classes, gpu=False)
solver = GenericSolver(iterations=10000, solver_type="SGD", base_lr=0.01, gamma=0.1, stepsize=30, momentum=0.9)
logs = clf.fit(train_data, validation_data=[test_data], solver=solver)
yte_pred = clf.predict(test_data)
Check out the example folder for more cases.