gnu-octave / statistics

The Statistics package for GNU Octave
GNU General Public License v3.0
24 stars 22 forks source link

Error installing statistics #89

Closed jonathanhhb closed 1 year ago

jonathanhhb commented 1 year ago

Hello. Don't have much experience with octave. I'm using it to get some matlab code running. The classify is apparently from statistics package but I can't install successfully. Is this a bug or something I can fix in user land?

octave:1> pkg install "https://github.com/gnu-octave/statistics/archive/refs/tags/release-1.5.4.tar.gz"
warning: creating installation directory /home/jbloedow/snap/octave/306/.local/share/octave/api-v57/packages
warning: called from
    install at line 36 column 5
    pkg at line 603 column 9

warning: function /home/jbloedow/snap/octave/306/.local/share/octave/api-v57/packages/statistics-1.5.4/shadow9/std.m shadows a core library function
warning: called from
    /home/jbloedow/snap/octave/306/.local/share/octave/api-v57/packages/statistics-1.5.4/PKG_ADD at line 11 column 3
    doc_cache_create>gen_doc_cache_in_dir at line 146 column 5
    doc_cache_create at line 62 column 12
    install>generate_lookfor_cache at line 840 column 5
    install at line 241 column 7
    pkg at line 603 column 9

warning: function /home/jbloedow/snap/octave/306/.local/share/octave/api-v57/packages/statistics-1.5.4/shadow9/median.m shadows a core library function
warning: called from
    /home/jbloedow/snap/octave/306/.local/share/octave/api-v57/packages/statistics-1.5.4/PKG_ADD at line 11 column 3
    doc_cache_create>gen_doc_cache_in_dir at line 146 column 5
    doc_cache_create at line 62 column 12
    install>generate_lookfor_cache at line 840 column 5
    install at line 241 column 7
    pkg at line 603 column 9

warning: function /home/jbloedow/snap/octave/306/.local/share/octave/api-v57/packages/statistics-1.5.4/shadow9/mean.m shadows a core library function
warning: called from
    /home/jbloedow/snap/octave/306/.local/share/octave/api-v57/packages/statistics-1.5.4/PKG_ADD at line 11 column 3
    doc_cache_create>gen_doc_cache_in_dir at line 146 column 5
    doc_cache_create at line 62 column 12
    install>generate_lookfor_cache at line 840 column 5
    install at line 241 column 7
    pkg at line 603 column 9

warning: function /home/jbloedow/snap/octave/306/.local/share/octave/api-v57/packages/statistics-1.5.4/shadow9/var.m shadows a core library function
warning: called from
    /home/jbloedow/snap/octave/306/.local/share/octave/api-v57/packages/statistics-1.5.4/PKG_ADD at line 11 column 3
    doc_cache_create>gen_doc_cache_in_dir at line 146 column 5
    doc_cache_create at line 62 column 12
    install>generate_lookfor_cache at line 840 column 5
    install at line 241 column 7
    pkg at line 603 column 9

warning: function /home/jbloedow/snap/octave/306/.local/share/octave/api-v57/packages/statistics-1.5.4/shadow9/std.m shadows a core library function
warning: called from
    doc_cache_create>gen_doc_cache_in_dir at line 146 column 5
    doc_cache_create at line 62 column 12
    install>generate_lookfor_cache at line 840 column 5
    install at line 241 column 7
    pkg at line 603 column 9

warning: function /home/jbloedow/snap/octave/306/.local/share/octave/api-v57/packages/statistics-1.5.4/shadow9/median.m shadows a core library function
warning: called from
    doc_cache_create>gen_doc_cache_in_dir at line 146 column 5
    doc_cache_create at line 62 column 12
    install>generate_lookfor_cache at line 840 column 5
    install at line 241 column 7
    pkg at line 603 column 9

warning: function /home/jbloedow/snap/octave/306/.local/share/octave/api-v57/packages/statistics-1.5.4/shadow9/mean.m shadows a core library function
warning: called from
    doc_cache_create>gen_doc_cache_in_dir at line 146 column 5
    doc_cache_create at line 62 column 12
    install>generate_lookfor_cache at line 840 column 5
    install at line 241 column 7
    pkg at line 603 column 9

warning: function /home/jbloedow/snap/octave/306/.local/share/octave/api-v57/packages/statistics-1.5.4/shadow9/var.m shadows a core library function
warning: called from
    doc_cache_create>gen_doc_cache_in_dir at line 146 column 5
    doc_cache_create at line 62 column 12
    install>generate_lookfor_cache at line 840 column 5
    install at line 241 column 7
    pkg at line 603 column 9

For information about changes from previous versions of the statistics package, run 'news statistics'.
octave:2> pkg load "https://github.com/gnu-octave/statistics/archive/refs/tags/release-1.5.4.tar.gz"
error: package https://github.com/gnu-octave/statistics/archive/refs/tags/release-1.5.4.tar.gz is not installed
error: called from
    load_packages at line 47 column 7
    pkg at line 623 column 7
octave:3>
jonathanhhb commented 1 year ago

image

pr0m1th3as commented 1 year ago

You have installed the statistics package successfully. After installation, you just type

pkg load statistics

in order to load it. Note, you only need to install it once, but you need you load it every time you open Octave.

jonathanhhb commented 1 year ago

You have installed the statistics package successfully. After installation, you just type

pkg load statistics

in order to load it. Note, you only need to install it once, but you need you load it every time you open Octave.

Thanks.

image

What am I missing?

jonathanhhb commented 1 year ago

You have installed the statistics package successfully. After installation, you just type

pkg load statistics

in order to load it. Note, you only need to install it once, but you need you load it every time you open Octave.

Thanks.

image

What am I missing?

I realize I'm not passing any params to classify so it wouldn't work, but I expect an error about params, not telling me that the package isn't installed.

I realize the warnings are "only" warnings, but they feel like errors based on the final "result".

acp29 commented 1 year ago

My understanding is that you are receiving this error because the function called 'classify' has not been coded (yet) in the Octave Statistics package. You don't get an error about function parameters because the function does not exist.

The warnings are simply because the statistics package has newer, more Matlab compatible versions of some functions, specifically mean, var, std, median. I imagine that in future versions, these warnings will disappear as the new functions will be moved to Octave core.

——

Dr Andrew Penn (he/his) Sussex Neuroscience School of Life Sciences University of Sussex Brighton BN1 9QG United Kingdom

Tel: +44 (0)1273 877049 E-mail: @.***

http://www.sussex.ac.uk/lifesci/pennlab/ http://www.researchgate.net/profile/Andrew_Penn https://scholar.google.com/citations?user=pDxdZaoAAAAJ&hl=en http://sussex.academia.edu/AndrewPenn

On 18 Apr 2023, at 19:19, Jonathan Bloedow @.***> wrote:

You have installed the statistics package successfully. After installation, you just type

pkg load statistics in order to load it. Note, you only need to install it once, but you need you load it every time you open Octave.

Thanks.

https://protect-eu.mimecast.com/s/aECoCp2XETgwnV5TPC6Ub?domain=user-images.githubusercontent.com What am I missing?

I realize I'm not passing any params to classify so it wouldn't work, but I expect an error about params, not telling me that the package isn't installed.

I realize the warnings are "only" warnings, but they feel like errors based on the final "result".

— Reply to this email directly, view it on GitHub https://protect-eu.mimecast.com/s/9qIPCqZMGFg28E9TXogd7?domain=github.com, or unsubscribe https://protect-eu.mimecast.com/s/NZbpCr9MJTym8kxu45BXX?domain=github.com. You are receiving this because you are subscribed to this thread.

jonathanhhb commented 1 year ago

My understanding is that you are receiving this error because the function called 'classify' has not been coded (yet) in the Octave Statistics package. You don't get an error about function parameters because the function does not exist. The warnings are simply because the statistics package has newer, more Matlab compatible versions of some functions, specifically mean, var, std, median. I imagine that in future versions, these warnings will disappear as the new functions will be moved to Octave core. —— Dr Andrew Penn (he/his) Sussex Neuroscience School of Life Sciences University of Sussex Brighton BN1 9QG United Kingdom Tel: +44 (0)1273 877049 E-mail: @. http://www.sussex.ac.uk/lifesci/pennlab/ http://www.researchgate.net/profile/Andrew_Penn https://scholar.google.com/citations?user=pDxdZaoAAAAJ&hl=en http://sussex.academia.edu/AndrewPenn On 18 Apr 2023, at 19:19, Jonathan Bloedow @.> wrote: You have installed the statistics package successfully. After installation, you just type pkg load statistics in order to load it. Note, you only need to install it once, but you need you load it every time you open Octave. Thanks. https://protect-eu.mimecast.com/s/aECoCp2XETgwnV5TPC6Ub?domain=user-images.githubusercontent.com What am I missing? I realize I'm not passing any params to classify so it wouldn't work, but I expect an error about params, not telling me that the package isn't installed. I realize the warnings are "only" warnings, but they feel like errors based on the final "result". — Reply to this email directly, view it on GitHub https://protect-eu.mimecast.com/s/9qIPCqZMGFg28E9TXogd7?domain=github.com, or unsubscribe https://protect-eu.mimecast.com/s/NZbpCr9MJTym8kxu45BXX?domain=github.com. You are receiving this because you are subscribed to this thread.

Oh!!! So the error message is literally true. I should have thought of that. :D

Maybe you can still help me. I'm doing an SVM train and test. It looks like SVM is implemented in the source code, so I think I should still be in luck. Maybe classify is just a high level utility wrapper around train and test?? I suppose that info is available somewhere. Can you suggest how I can call existing individual octave svm functions to do what Matlab's classify does?

jonathanhhb commented 1 year ago

https://www.mathworks.com/help/stats/classify.html?searchHighlight=classify&s_tid=srchtitle_classify_1

fitcdiscr and predict are recommended over classify for training a discriminant analysis classifier and predicting labels. fitcdiscr supports cross-validation and hyperparameter optimization, and does not require you to fit the classifier every time you make a new prediction or change prior probabilities.

But I don't think fitcdiscr is implemented in octave. But there's probably something close enough?

jonathanhhb commented 1 year ago

ChatGPT says:

pkg load statistics

# Create a svm Classifier
clf = fitcsvm(X_train, y_train, 'KernelFunction', 'linear');

# Predict the response for test dataset
y_pred = predict(clf, X_test);
pr0m1th3as commented 1 year ago

SVM in the statistics package is supported through the libsvm library. The functions available are svmtrain and svmpredict.

jonathanhhb commented 1 year ago

SVM in the statistics package is supported through the libsvm library. The functions available are svmtrain and svmpredict.

Awesome. That seems to be what I need. Please feel free to close the ticket as resolved. Appreciate your software and your support.