This is a WIP project for saving scikit-learn models to Neo4j.
You can install it using the following command:
pip install git+https://github.com/neo4j-graph-analytics/sklearn-neo4j.git#egg=sklearn-neo4j
Here’s a simple example showing how to save and load a BayesianRidge model.
from neo4j.v1 import GraphDatabase, basic_auth
from sklearn import linear_model
from skneo4j.model_persistence import ModelPersistence
model_persistence = ModelPersistence(GraphDatabase.driver("bolt://localhost", auth=basic_auth("neo4j", "neo")))
X = [[0., 0.], [1., 1.], [2., 2.], [3., 3.]]
Y = [0., 1., 2., 3.]
reg = linear_model.BayesianRidge()
reg.fit(X, Y)
model_name = "MyTestModel"
model_persistence.save(reg, model_name)
print(reg.predict([[1, 0.]]))
new_reg = model_persistence.load(model_name)
print(new_reg.predict([[1, 0.]]))