-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
cookbook - CARTree - classification tree #3282
Conversation
It should be easier to use a bool vector... |
@OXPHOS currently the meta language does not support
I think we should add both. @sorig do you have an idea how much work that is? We would need to adjust the include path stuff (similar to what @OXPHOS did in this patch), and then wrapping the |
I rebased based on #3285 but got the same error here and at local. I removed I was using:
|
It works on my machine. Ask travis, it might confirm |
Let me know if you need help with this. Java error is caused by java.json#L14 not using the correct type. You need to figure out how C# is also an error with mapped types. Take the generated C# file, figure out how to make it compile, and update the
The errors in the other languages are probably similar, but need investigation. |
38f3211
to
9cdce5c
Compare
@sorig Hey I have got some results, but not solutions... There's another problem in Java, even if the above one is solved, also appeared in #3303: //![set_attribute_types]
DoubleMatrix ft = new DoubleMatrix(2);
ft.put(0, 0);
ft.put(1, 0);
//![set_attribute_types] If I create a vector of length 2 in meta language (and translated in //![create_instance]
CARTree classifier = new CARTree(ft, PT_MULTICLASS, 5, true);
//![create_instance] and output the length of the vector in CCARTree::CCARTree(SGVector<bool> attribute_types, EProblemType prob_type, int32_t num_folds, bool cv_prune): CTreeMachine<CARTreeNodeData>()
{
std::cerr << "vector length: " << attribute_types.vlen << std::endl;
} I will get: |
@karlnapf any thoughts? : ) |
@OXPHOS I can look at this, shall I just copy the meta example in this PR? Does it reproduce the errors. |
@karlnapf Maybe you could reproduce the error by using the code in #3303, where the error is simpler: When passing a vector
to the constructor:
The vector will have size of 1. |
The "other" problem should be solved in #3451 |
There is another problem with csharp and boolean vectors --- we don't have a typemap, which means we cannot pass boolean vectors as input in the csharp interface, see #3452 This, sadly, means that for now, we have to change this example to not using boolean vectors that are hand-constructed as parameters. Instead, we can create an instance of the (mapped) |
Can you rebase? Should work now |
5e21025
to
b4924d9
Compare
7f673ba
to
b4924d9
Compare
I guess this needs an updated data version and a squash. It is all ready otherwise |
Can you please run the tests locally (at least the cpp version) before putting things into the PR. This would have been detected locally. Is done with |
See the error is coming from a missing shogun-data update The generated test passed: But checking against reference data failed: |
And it even tells you the line where it differs: |
@karlnapf Thanks..! I saw only some of the tests failed so I thought it should be some specific errors without checking closely.. I updated the test dataset and it worked for me at local now. |
So let's get it in then :) |
54a6052
to
44a8ee9
Compare
|
Ah sigh, I thought I had solved that. But we have a mechanic to fix this...checking ... |
@OXPHOS rebase against develop, then it should work (I tried locally for all interfaces that failed in the last build here) |
f3aac11
to
3ebab4e
Compare
@OXPHOS You should always try these things locally before you push. At least in one modular language. So here is the listing I used (no fixed random seed) Note that meta language syntax is Also, check out the docs for |
I dont understand the failure in octave. Checking again. The rest looks fine |
Ok so works locally for oactave, I restarted the build |
This seems to be specific to the travis setup, I don't have this problem locally .... |
… fixes the last problem in shogun-toolbox#3282 and is followup for shogun-toolbox#3550
3ebab4e
to
fbd979c
Compare
@karlnapf It finally works! Thanks for the advice and sorry that I skipped the local test because of laziness. |
Nice one, this was a big effort to get these Boolean vectors working. But it really helped in figuring out corner cases of the whole system. Thanks for the patience :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some minor style updates would be good :)
Classification And Regression Tree | ||
================================== | ||
|
||
Decision tree learning uses a decision tree as a predictive model which maps observations about an item to conclusions about the item's target value. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Decition tree learning is based on trees as predictive models. (Remove the second sentence)
|
||
Decision tree learning uses a decision tree as a predictive model which maps observations about an item to conclusions about the item's target value. | ||
|
||
Decision trees are mostly used as the following two types: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are two types of decision trees:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or even better: There are decision trees for both classification (integer-valued) and regression (real-valued).
- Classification tree, where the predicted outcome is the class to which the data belongs. | ||
- Regression tree, where predicted outcome can be considered a real number. | ||
|
||
Classification And Regression Tree (CART) algorithm is an umbrella method that can be applied to generate both classification tree and regression tree. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The classification and regression tree
(CART) algorithm is an umbrella method ....
|
||
Classification And Regression Tree (CART) algorithm is an umbrella method that can be applied to generate both classification tree and regression tree. | ||
|
||
In this example, we showed how to apply CART algorithm to multi-class dataset and predict the labels with classification tree. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this example, we show how to apply CART to multi-class datasets.
Remove the rest and fix typos
|
||
.. sgexample:: cartree.sg:create_features | ||
|
||
We set the type of each predictive attribute (true for nominal, false for ordinal/continuous) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These words you can also use above when you talk about regression/classification values
.. sgexample:: cartree.sg:set_attribute_types | ||
|
||
We create an instance of the :sgclass:`CCARTree` classifier by passting it the attribute types and the tree type. | ||
We can also set the number of subsets used in cross-valiation and whether to use cross-validation pruning. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A reference to a wiki article would be good here
… fixes the last problem in shogun-toolbox#3282 and is followup for shogun-toolbox#3550
… fixes the last problem in shogun-toolbox#3282 and is followup for shogun-toolbox#3550
cookbook - CARTree - classification tree
make cookbook
fails because of the changes I made for the first point.