Skip to content

neo4j-graph-analytics/sklearn-neo4j

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

sklearn-neo4j: Save your scikit-learn models in Neo4j

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

How do I use it?

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.]]))

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages