kaz-Anova / StackNet

StackNet is a computational, scalable and analytical Meta modelling framework
MIT License
1.32k stars 344 forks source link

The last layer of StackNet cannot have a classifier #21

Closed afhuertass closed 7 years ago

afhuertass commented 7 years ago

Hi !

I'm having some troubles trying to make StackNet work. I have a very humble PC( reason why I dont want to test the examples included, they will probably kill my potato-PC ) and i would like to try some small models, in order to get a feeling of the software and how to use it :)

So for example I setup a parameters file with the next contents

LogisticRegression Type:Liblinear C:0.8 threads:1 usescale:True maxim_Iteration:100 seed:1 verbose:false
LogisticRegression Type:Liblinear C:0.5 RegularizationType:L1 threads:1 usescale:True maxim_Iteration:20 seed:1 verbose:false

RandomForestClassifier verbose:false

I run the java -jar etc etc and it seems to be running, but after a while i get this error

Exception in thread "main" java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:58) Caused by: exceptions.IllegalStateException: The last layer of StackNet cannot have a classifier at ml.stacknet.StackNetRegressor.fit(StackNetRegressor.java:2516) at stacknetrun.runstacknet.main(runstacknet.java:524)

So, i what to know what is causing this error and how to fix it.

Thanks in advance, This is a really interesting piece of software, amazing job ! :)

kaz-Anova commented 7 years ago

Hello @afhuertass

When you run Stacknet, you need to specify whether you run classification or regression . eg: Java –jar stacknet.jar train task=classification (or regression).

If you don't specify, the default is regression .

If you run regression, StackNet expects a Regressor for the final layer as it will have to produce scores not probabilities.

If you wanted regression , then your final layer should be:

RandomForestRegressor verbose:false

Otherwise change the parameter task= classification when you execute the jar.

Let me know if this explanation works.

afhuertass commented 7 years ago

That was the problem. Thanks :D