fxsjy / gonn Goto Github PK
View Code? Open in Web Editor NEWGoNN is an implementation of Neural Network in Go Language, which includes BPNN, RBF, PCN
GoNN is an implementation of Neural Network in Go Language, which includes BPNN, RBF, PCN
I am using the wrapper of scikit-learn Multilayer Perceptron in Python https://github.com/aigamedev/scikit-neuralnetwork to train the neural network and save it to a file. Now, I want to expose it on production to predict in real time. So, I was thinking to use Golang for better concurrency than Python. Hence, my question is whether can we read the model using this library written using Python or above wrapper? The code below I am using for training the model and last three lines I want to port to GOLang to expose it on production
import pickle
import numpy as np
import pandas as pd
from sknn.mlp import Classifier, Layer
from sklearn.model_selection import train_test_split
from sklearn.metrics import accuracy_score
f = open("TrainLSDataset.csv")
data = np.loadtxt(f,delimiter = ',')
x = data[:, 1:]
y = data[:, 0]
X_train, X_test, y_train, y_test = train_test_split(x, y, test_size=0.3)
nn = Classifier(
layers=[
Layer("Rectifier", units=5),
Layer("Softmax")],
learning_rate=0.001,
n_iter=100)
nn.fit(X_train, y_train)
filename = 'finalized_model.txt'
pickle.dump(nn, open(filename, 'wb'))
**#Below code i want to write in GoLang for exposing it on Production** :
loaded_model = pickle.load(open(filename, 'rb'))
result = loaded_model.score(X_test, y_test)
y_pred = loaded_model.predict(X_test)
Cool project :)
Just wondering: So, you are not using any go-routines or channels, to do the threading (didn't see any, in my very brief look)?
I have been testing a bit with how to speedup stuff that passes around strings between threads, and found it very useful to set up the size for the buffers in the channels ... to something like 512 items etc ...
(I wrote up a bit about my experiment here: http://saml.rilspace.org/go-speedup-with-threading-for-line-by-line-string-processing ... and the threaded code is here: https://gist.github.com/samuell/5829991 )
Also, I heard that it is adviseable to set runtime.GOMAXPROCS to number of cores - 1, as a rule of thumb (maybe you do that already, so just saying, just in case) ...
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.