Feature importance gbm and caret - feature-selection

I am using the caret package for GBM predictions and comparing them with the GBM function, from GBM package. When I plot the feature importance from each model (caret - varImp - and GBM - summary.gbm), the results were very different. Besides the difference in importance value, the features between both models were completely different, too.
Does any one know why? Is correct to use the function varImp to observe this, or I can just use summary.gbm?
Thank you!

Related

FastAI How would I approach predicting lottery numbers using FastAI? Are there any easy tutorials? Where would I start?

I was working on a Keras LSTM for predicting lottery numbers in jupyter. I have a csv with the complete history of 6000 winning sets of numbers. I started using Colab to speed things up and upgraded to Pro+ but there was no difference with the upgraded processors. I came across FastAI and I have everything installed. I am completely new to FastAI and the tutorials seem complicated for serious projects.
Is there any FastAI tutorials to predict lottery numbers (6/39)?
If not how would I approach this?
What area should I focus on?
Thanks in advance...
FastAI is great at supporting easy out-of-the-box solutions for a few key problem types: namely natural text, image, tabular, and collaborative filtering. Your use-case is not exactly any of these, but I expect it is possible to use the text model functionality. This tutorial shows how an LSTM language model learns to predict the next word given a sentence which seems very similar to your use-case.
You will want to avoid the tokenization and numericalization steps of the text model, since you already have numerical tokens in place of words. I imagine you can get something to work either by explicitly turning those steps off or by passing in the lists as space-separated text and letting it re-tokenize/numericalize.

Non-liner solver couldn't converge during the initialization in Dymola

I met an error during initialization when using ThermoSysPro library.
It seems like the Turbine5.Pe is larger than Turbine2.Pe, so the result is negative. but I checked my parameters, there shouldn't be such a problem.
Is this because the nonlinear solver couldn't solve the equation in the following picture?
There is not enough information and I would recommend to set Details and/or Nonlinear iterations in Simulation setup>Debug>Nonlinear solver diagnostics to get more information.
The full expression causing the problem is sqrt((Turbine2.Pe^2-Turbine5.Pe^2)/(Turbine2.Cst*Turbine2.proe.T))
Since the two Pe-values have fixed=true it seems unlikely that they are wrong, but it is impossible to see without the complete model.
However, it is also possible that either Cst or proe.T is negative, or computed to a negative value based on other values.
Without a complete model that is impossible to tell.
According to the comparison between ThermoSysPro(Open source library from EDF https://github.com/alex19941215/ThermoSysPro ) and ThermalPower(Commercial library from Modelon https://www.modelon.com/library/thermal-power-library ), there should be some inspiration for people faced with the same situation.
Here is the code form ThermoSysPro library:
Connectors.FluidInlet Ce
Connectors.FluidOutlet Cs
Here is a type code from Thermal Power library:
Interfaces.FlowPort feed(
h_outflow(start=hstartin))
Interfaces.FlowPort drain(
p(start=pstart),
h_outflow(start=hstartout))
From the code, we can see that in the Thermal Power library each connector's attribute is assigned values according to the parameters, but in the ThermoSysPro library, the connector is using default values, probably zero. So that's why the Thermal Power library has better performance in the term of initialization convergence

Can you implement an offset in h2o.gbm with a multinomial response (K > 2)?

My goal is take the outcome class probability predictions from another model (or wherever, really), and use them as an offset in h2o.gbm with distribution = "multinomial".
I noticed in the nnet package, the multinom() function allows for an offset with as many columns as there are outcome classes (K). Does something like this exist for h2o GBM's?
No, offsets for multinomial GBM is currently not supported, mostly because of the API implications (offset_column would change semantics everywhere in the code), but it wouldn't be hard to implement otherwise.
The only option right now is to use the offset columns as additional predictors.

Why too few features are selected in this dataset by subset selection method

I have a classification dataset with 148 input features (20 of which are binary and the rest are continuous on the range [0,1]). The dataset has 66171 negative example and only 71 positive examples.
The dataset (arff text file) can be downloaded from this dropbox link: https://dl.dropboxusercontent.com/u/26064635/SDataset.arff.
In Weka suite, when I use CfsSubsetEval and GreedyStepwise (with setSearchBackwards() set to true and also false), the selected feature set contains only 2 features (i.e. 79 and 140)! It is probably needless to say that the classification performance with these two features are terribly bad.
Using ConsistencySubsetEval (in Weka as well) leads to the selection of ZERO features! When feature ranking methods are used instead and the best (e.g. 12) features are selected, a much better classification performance is achieved.
I have two questions:
First, What is it about the dataset that leads to the selection of such a few features? is it because of the imbalance between the number of positive and negative examples?
Second, and more importantly, are there any other subset selection methods (in Matlab or otherwise) that I can try and may lead to the selection of more features?
Clearly, the class imbalance is not helping. You could try to take a subsample of the dataset for better diagnostic. SpreadSubsample filter lets you do that, stating what are the maximun class imbalance admisible, like 10:1, 3:1, or whatever you find appropriate.
For selection methods, you could try dimensionality reduction methods, like PCA, in WEKA, first.
But if the algorithms are selecting those sets of features, they seem to be the most meaningful for your classificatin task.

Modelica.Media.R134a Error

In the Modelica Standard Library 3.2.1 a model for the refrigerant R134a was included, but it seems not to work properly with Modelica.Fluid. In a simple example with one DynamicPipe, it results in the following error:
A calculation of two-phase properties with input of pressure and temperature is not possible.
Please use setState_dTX or setState_phX instead.
The stack of functions is:
setState_pTX_Unique15
setState_pTX_Unique15(101325, 293.15, {1.0}, 0)
use_T_start is false. What is the problem here? How can it be solved?
TIA
Update:
The selected states are h and p, as it should be. The parameters of the pTX call seem to be the default values for the chosen medium.
PartialStaggeredFlowModel uses Medium.density_pTX and Medium.setState_pTX, but changing these to the respective phX-functions does not solve the problem.
The issue here is your choice of thermodynamic states. As the message indicates, you cannot use a two-phase medium with pressure and temperature as the thermodynamic states.
As a simple example, consider water/ice. If you measure the temperature as it is freezing, you'll see that when the mixture is "slushy" (contains both liquid and solid), the temperature will remain constant. So knowing the temperature is not sufficient to know the true (thermodynamic) state of the system because we cannot compute the relative fractions of liquid and solid with that information. The solution is to use pressure and enthalpy (as the error message suggests) as the thermodynamic states.
I don't know enough about the Modelica.Media and Modelica.Fluid libraries to tell you how to change your selection of thermodynamic states. But I suspect you'll find the answer in the documentation of one of those libraries.
The solution is already in my update. PartialStaggeredFlowModel uses Medium.density_pTX and Medium.setState_pTX. Replacing these with Medium.density_phX and Medium.setState_phX avoids the pT-problem. The reason why it did not work at first was one reference to the unmodified class I forgot to change.
Other Modelica.Fluid-components have the same problem, e.g. the pump-models are based on PartialPump, which also uses Medium.density_pTX.
Thank you for your contributions.