Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Classification of the Spiral dataset #20

Open
bermat72 opened this issue Jan 18, 2021 · 0 comments
Open

Classification of the Spiral dataset #20

bermat72 opened this issue Jan 18, 2021 · 0 comments

Comments

@bermat72
Copy link

Hi there, and thank you very much for this brilliant work with MiniDNN.
I am slowly understanding more and more of the code.

Right now I am testing MiniDNN used to classify the the Spiral dataset:
https://cs231n.github.io/neural-networks-case-study/

It doesnt seem to find the optimum.

Any tips on my code, or what optimizer to use?
Have anyone of you tried a testdata for classification?

I would be happy to put together some testdata and make a another tutorial example..... with some help. :)

Sincerely,
Bernt

// Code to read in data and put it into Matrix is scipped.

Network net;
Layer* layer1 = new FullyConnected<Sigmoid>(2, 20);
Layer* layer2 = new FullyConnected<ReLU>(20, 20);
Layer* layer3 = new FullyConnected<Softmax>(20, 3);
net.add_layer(layer1);
net.add_layer(layer2);
net.add_layer(layer3);

net.set_output(new MultiClassEntropy() );

//Adam opt;
//opt.m_lrate = 0.01;
SGD opt;
    
VerboseCallback callback;
net.set_callback(callback);
net.init(0, 0.01, 000);

int nr_epochs = 3000;
net.fit(opt, Xdata.transpose(), Ydata.transpose(), 60, nr_epochs , 000);

Matrix pred = net.predict(Xtest.transpose() );
Matrix P = pred.transpose();

std::cout << P.rows()  << "  " << P.cols() << std::endl;
for(int r = 0; r < P.rows() ; r++){
    std::cout << P(r,0) << " " << P(r,1) << " " << P(r,2) << "\n";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant