Re: XGBoost Installation
Prakash Bhagat <[email protected]>
| Newsgroups | gmane.comp.ai.weka |
|---|---|
| Message-ID | <[email protected]> |
Dear Eibe, For my thesis I have to submit code used. I have used WEKA to provide results. Is there a way to download what I have done and download it as a csv file. That is, showing the preprocessing and classification done on a dataset? Kind regards, Prakash > On 07 Jun,2021, at 10:38, Eibe Frank <[email protected]> wrote: > > That tutorial is for RPlugin in WEKA 3.8.0. The process has been changed, and installation of the RPlugin should now be fully automatic. All you need to do is install R before you install the RPlugin. The RPlugin will find R if it is installed in the standard location, configure all environment variables for you, and also install rJava automatically in R. It is best not to interfere with this process by setting some environment variables yourself. > > Cheers, > Eibe > > On Mon, Jun 7, 2021 at 8:28 PM Prakash Bhagat <[email protected] <mailto:[email protected]>> wrote: > I checked the AUC score and it was also quite low around 0.55. > The parameters tuned were as follows: > booster = "gbtree", > objective = "binary:logistic", > max_depth = sample(3:10, 1), > eta = runif(1, .01, .3), > subsample = runif(1, .7, 1), > colsample_bytree = runif(1, .6, 1), > min_child_weight = sample(0:10, 1) > > I was running weka using bootcamp in Mac however that has crashed and I need to download R for weka using Mac again. > Following your advice I have left R_HOME blank and specified the directory where R for weka was downloaded in step 6 of this : https://riptutorial.com/weka/topic/7916/how-to-use-r-in-weka <https://riptutorial.com/weka/topic/7916/how-to-use-r-in-weka> > I still do not see the mlr classifier however. Please could you help me solve this. > > Kind regards, > Prakash > >> On 07 Jun,2021, at 01:19, Eibe Frank <[email protected] <mailto:[email protected]>> wrote: >> >> When you are minimising unequal misclassification cost, plain classification accuracy is not the correct metric to look at! >> >> Also, make sure you turn on the minimum-expected cost option in CostSensitiveClassifier, as mentioned in my earlier message. >> >> You also need to experiment with the other XGBoost parameters, particularly the tree depth. If your dataset exhibits interaction effects between many attributes, you will need to grow deeper trees (max depth 3, as in my example, may not be sufficient). >> >> Cheers, >> Eibe >> >> On Mon, Jun 7, 2021 at 12:27 AM Prakash Bhagat <[email protected] <mailto:[email protected]>> wrote: >> Thanks, >> I did so however in my problem the cost of a False Positive is 5 times more than a False Negative thus the confusion matrix used is [0.0 1.0; 5.0 0.0]. When implementing the setting you suggested I get an accuracy of 57% still relatively low. >> The highest I was able to get was 67% when using nrounds=1000. >> Could it just be that XGBoost does not work as well as knn and rf for this case or am I missing something? >> >> Kind regards, >> Prakash >> >> On Sun, Jun 6, 2021 at 2:13 AM Eibe Frank <[email protected] <mailto:[email protected]>> wrote: >> Looking at the configuration string I posted, you will see >> >> -learner classif.xgboost -params nrounds=100,max_depth=3,subsample=0.5,colsample_bynode=0.5 >> >> The >> >> -params >> >> flag introduces the parameters that will be used for the MLR learner that is specified. You need to paste those into the corresponding text field in the GenericObjectEditor when you configure MLRClassifier. >> >> Yes, you should use the same cost matrix. >> >> Cheers, >> Eibe >> >> On Sun, Jun 6, 2021 at 1:09 PM Prakash Bhagat <[email protected] <mailto:[email protected]>> wrote: >> Thanks so much for this! >> For your first point, how do I set a minimum number of boosting iterations? >> I have looked within the MLR classifier setting however see no option for min iterations. >> If I use a cost matrix in the classifier then under more options for test I should create the same confusion matrix, correct? >> >> Kind regards, >> Prakash >> >> On Sat, Jun 5, 2021 at 12:56 PM Eibe Frank <[email protected] <mailto:[email protected]>> wrote: >> The default number of iterations used by XGBoost when applied through the RPlugin is 1. You definitely need to increase the number of boosting iterations. I would also switch the CostSensitiveClassifier to use the minimum-expected cost approach, not the default approach based on reweighting the training data. >> >> Of course, you should also specify the same cost matrix for evaluation under "More options..." in the Classify tab. >> >> The following configuration worked well in a quick try on the sonar data from the UCI repository: >> >> weka.classifiers.meta.CostSensitiveClassifier -cost-matrix "[0.0 5.0; 1.0 0.0]" -M -W weka.classifiers.mlr.MLRClassifier -- -learner classif.xgboost -params nrounds=100,max_depth=3,subsample=0.5,colsample_bynode=0.5 >> >> You can right-click on the text field containing the classifier configuration in the Classify panel and paste the above configuration into the Explorer (assuming you have a dataset with only two classes, it should work). >> >> The reason for using the minimum-expected cost mode of the CostSensitiveClassifier is that it does not change the training data. The default mode of the CostSensitiveClassifier uses instance weights in the training data to reflect costs. I don't know how well that works in conjunction with MLRClassifier. >> >> Cheers, >> Eibe >> >> On Sat, Jun 5, 2021 at 11:33 PM Prakash Bhagat <[email protected] <mailto:[email protected]>> wrote: >> Thanks very much, >> >> I have managed to get windows access and followed the tutorial on youtube for downloading the rplugin. I am using xgboost as a classification method and comparing it to random forests. Random forest gives an accuracy of 75% whereas XGBoost gives an accuracy of only 52%. I was wondering if you could help me as i may have made some errors when implementing xgboost. >> I have attached the data used. I filled in missing values for revol_util and converted nominal features to binary when using xgboost. >> I then used the costsensitiveclassifier with a 5 to 1 cost for false positives and used 5 fold cross-validation. Following this, I used mlrclassifier and used classif.xgboost under Rlearner. >> I will do hyper parameter tuning after but was wandering if i had made a mistake with xgboost as the accuracy is so low. >> Any help would be much appreciated! >> >> Kind regards, >> Prakash >> >> On Sat, Jun 5, 2021 at 4:16 AM Eibe Frank <[email protected] <mailto:[email protected]>> wrote: >> You cannot set environment variables, etc., in WEKA's built-in CLI, which is really quite primitive and only pretends to be a proper OS terminal! You need to run the command in the macOS terminal. However, as I said, you should not set R_HOME explicitly unless you have installed R in a non-standard location. WEKA's RPlugin will find R on the Mac if it is installed in the standard place. >> >> Cheers, >> Eibe >> >> On Sat, Jun 5, 2021 at 1:43 PM Prakash Bhagat <[email protected] <mailto:[email protected]>> wrote: >> Yes, I have followed this guide: https://riptutorial.com/weka/topic/7916/how-to-use-r-in-weka <https://riptutorial.com/weka/topic/7916/how-to-use-r-in-weka> >> I pasted this in the command line in WEKA: export R_HOME=/Library/Frameworks/R.framework/Resources >> java -Xss10M -Xmx4096M -cp .:weka.jar weka.gui.GUIChooser >> >> And this is the error from weka: >> <Screenshot 2021-06-04 at 14.02.40.png> >> >> Kind regards, >> Prakash >> >> >> >>> On 04 Jun,2021, at 13:52, Eibe Frank <[email protected] <mailto:[email protected]>> wrote: >>> >>> Are you still running WEKA with R_HOME set to some value? It is normally best to let WEKA set the value of R_HOME itself. >>> >>> If there are any error messages shown in the terminal from which you run WEKA, it would be useful to share those. >>> >>> Cheers, >>> Eibe >>> >>> On Fri, Jun 4, 2021 at 11:43 PM Prakash Bhagat <[email protected] <mailto:[email protected]>> wrote: >>> https://github.com/SigDelta/weka-xgboost/releases <https://github.com/SigDelta/weka-xgboost/releases> - This is the link I used to download xgboost. >>> Using this downloaded I installed xgboost as an unofficial package in tools. It then comes under trees however does not run. >>> >>> With the RPlugin the MLR classifier is unavailable to use. I have downloaded a new version of R and within R I also downloaded the MLR package. This still however does not run. >>> I have installed rJava within R as well. >>> <Screenshot 2021-06-04 at 11.51.31.png> >>>> On 04 Jun,2021, at 11:07, Eibe Frank <[email protected] <mailto:[email protected]>> wrote: >>>> >>>> Which unofficial version do you mean? Both, RPlugin and wekaPython, are official packages, and both enable you to use XGBoost. With the RPlugin, you need to use XGBoost through the MLRClassifier and select XGBoost as the base learner (the first time you select this base learner, it will try to install it in R, which may take a while). Similarly, with wekaPython, you also need to use the corresponding ScikitLearnClassifier in WEKA with XGBoost as the base learner (and you need to have XGBoost installed in your relevant Python environment, which you may need to do manually). >>>> >>>> The easiest way to use XGBoost in WEKA is probably through the RPlugin because the only manual work you (normally) need to do is to install R. >>>> >>>> There might be an unofficial WEKA package for XGBoost out there, but it may not be maintained. >>>> >>>> Cheers, >>>> Eibe >>>> >>>> >>>> On Fri, Jun 4, 2021 at 4:49 PM <[email protected] <mailto:[email protected]>> wrote: >>>> Dear All, >>>> >>>> I have a mac with the latest version of R and python installed. I am using WEKA for an assignment and need to use XGBoost. >>>> I have tried downloading the unofficial version as a package however that does not work. >>>> I then tried the R Plugin version downloading RPlugin and pasting this in the command line in WEKA: >>>> export R_HOME=/Library/Frameworks/R.framework/Resources >>>> java -Xss10M -Xmx4096M -cp .:weka.jar weka.gui.GUIChoose >>>> >>>> This however did not work either and R does not run. >>>> >>>> If anyone has a very specific step-by-step guide to getting XGBoost on macOS please let me know! >>>> >>>> Kind regards, >>>> PYB >>>> _______________________________________________ >>>> Wekalist mailing list -- [email protected] <mailto:[email protected]> >>>> Send posts to [email protected] <mailto:[email protected]> >>>> To unsubscribe send an email to [email protected] <mailto:[email protected]> >>>> To subscribe, unsubscribe, etc., visit https://list.waikato.ac.nz/postorius/lists/wekalist.list.waikato.ac.nz <https://list.waikato.ac.nz/postorius/lists/wekalist.list.waikato.ac.nz> >>>> List etiquette: http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html <http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html> >>>> _______________________________________________ >>>> Wekalist mailing list -- [email protected] <mailto:[email protected]> >>>> Send posts to [email protected] <mailto:[email protected]> >>>> To unsubscribe send an email to [email protected] <mailto:[email protected]> >>>> To subscribe, unsubscribe, etc., visit https://list.waikato.ac.nz/postorius/lists/wekalist.list.waikato.ac.nz <https://list.waikato.ac.nz/postorius/lists/wekalist.list.waikato.ac.nz> >>>> List etiquette: http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html <http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html> >>> >>> _______________________________________________ >>> Wekalist mailing list -- [email protected] <mailto:[email protected]> >>> Send posts to [email protected] <mailto:[email protected]> >>> To unsubscribe send an email to [email protected] <mailto:[email protected]> >>> To subscribe, unsubscribe, etc., visit https://list.waikato.ac.nz/postorius/lists/wekalist.list.waikato.ac.nz <https://list.waikato.ac.nz/postorius/lists/wekalist.list.waikato.ac.nz> >>> List etiquette: http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html <http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html> >>> _______________________________________________ >>> Wekalist mailing list -- [email protected] <mailto:[email protected]> >>> Send posts to [email protected] <mailto:[email protected]> >>> To unsubscribe send an email to [email protected] <mailto:[email protected]> >>> To subscribe, unsubscribe, etc., visit https://list.waikato.ac.nz/postorius/lists/wekalist.list.waikato.ac.nz <https://list.waikato.ac.nz/postorius/lists/wekalist.list.waikato.ac.nz> >>> List etiquette: http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html <http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html> >> >> _______________________________________________ >> Wekalist mailing list -- [email protected] <mailto:[email protected]> >> Send posts to [email protected] <mailto:[email protected]> >> To unsubscribe send an email to [email protected] <mailto:[email protected]> >> To subscribe, unsubscribe, etc., visit https://list.waikato.ac.nz/postorius/lists/wekalist.list.waikato.ac.nz <https://list.waikato.ac.nz/postorius/lists/wekalist.list.waikato.ac.nz> >> List etiquette: http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html <http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html> >> _______________________________________________ >> Wekalist mailing list -- [email protected] <mailto:[email protected]> >> Send posts to [email protected] <mailto:[email protected]> >> To unsubscribe send an email to [email protected] <mailto:[email protected]> >> To subscribe, unsubscribe, etc., visit https://list.waikato.ac.nz/postorius/lists/wekalist.list.waikato.ac.nz <https://list.waikato.ac.nz/postorius/lists/wekalist.list.waikato.ac.nz> >> List etiquette: http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html <http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html> >> _______________________________________________ >> Wekalist mailing list -- [email protected] <mailto:[email protected]> >> Send posts to [email protected] <mailto:[email protected]> >> To unsubscribe send an email to [email protected] <mailto:[email protected]> >> To subscribe, unsubscribe, etc., visit https://list.waikato.ac.nz/postorius/lists/wekalist.list.waikato.ac.nz <https://list.waikato.ac.nz/postorius/lists/wekalist.list.waikato.ac.nz> >> List etiquette: http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html <http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html> >> _______________________________________________ >> Wekalist mailing list -- [email protected] <mailto:[email protected]> >> Send posts to [email protected] <mailto:[email protected]> >> To unsubscribe send an email to [email protected] <mailto:[email protected]> >> To subscribe, unsubscribe, etc., visit https://list.waikato.ac.nz/postorius/lists/wekalist.list.waikato.ac.nz <https://list.waikato.ac.nz/postorius/lists/wekalist.list.waikato.ac.nz> >> List etiquette: http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html <http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html> >> _______________________________________________ >> Wekalist mailing list -- [email protected] <mailto:[email protected]> >> Send posts to [email protected] <mailto:[email protected]> >> To unsubscribe send an email to [email protected] <mailto:[email protected]> >> To subscribe, unsubscribe, etc., visit https://list.waikato.ac.nz/postorius/lists/wekalist.list.waikato.ac.nz <https://list.waikato.ac.nz/postorius/lists/wekalist.list.waikato.ac.nz> >> List etiquette: http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html <http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html> >> _______________________________________________ >> Wekalist mailing list -- [email protected] <mailto:[email protected]> >> Send posts to [email protected] <mailto:[email protected]> >> To unsubscribe send an email to [email protected] <mailto:[email protected]> >> To subscribe, unsubscribe, etc., visit https://list.waikato.ac.nz/postorius/lists/wekalist.list.waikato.ac.nz <https://list.waikato.ac.nz/postorius/lists/wekalist.list.waikato.ac.nz> >> List etiquette: http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html <http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html> >> _______________________________________________ >> Wekalist mailing list -- [email protected] <mailto:[email protected]> >> Send posts to [email protected] <mailto:[email protected]> >> To unsubscribe send an email to [email protected] <mailto:[email protected]> >> To subscribe, unsubscribe, etc., visit https://list.waikato.ac.nz/postorius/lists/wekalist.list.waikato.ac.nz <https://list.waikato.ac.nz/postorius/lists/wekalist.list.waikato.ac.nz> >> List etiquette: http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html <http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html> >> _______________________________________________ >> Wekalist mailing list -- [email protected] <mailto:[email protected]> >> Send posts to [email protected] <mailto:[email protected]> >> To unsubscribe send an email to [email protected] <mailto:[email protected]> >> To subscribe, unsubscribe, etc., visit https://list.waikato.ac.nz/postorius/lists/wekalist.list.waikato.ac.nz <https://list.waikato.ac.nz/postorius/lists/wekalist.list.waikato.ac.nz> >> List etiquette: http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html <http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html> > > _______________________________________________ > Wekalist mailing list -- [email protected] <mailto:[email protected]> > Send posts to [email protected] <mailto:[email protected]> > To unsubscribe send an email to [email protected] <mailto:[email protected]> > To subscribe, unsubscribe, etc., visit https://list.waikato.ac.nz/postorius/lists/wekalist.list.waikato.ac.nz <https://list.waikato.ac.nz/postorius/lists/wekalist.list.waikato.ac.nz> > List etiquette: http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html <http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html> > _______________________________________________ > Wekalist mailing list -- [email protected] > Send posts to [email protected] > To unsubscribe send an email to [email protected] > To subscribe, unsubscribe, etc., visit https://list.waikato.ac.nz/postorius/lists/wekalist.list.waikato.ac.nz > List etiquette: http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html _______________________________________________ Wekalist mailing list -- [email protected] Send posts to [email protected] To unsubscribe send an email to [email protected] To subscribe, unsubscribe, etc., visit https://list.waikato.ac.nz/postorius/lists/wekalist.list.waikato.ac.nz List etiquette: http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html