
Security News
Crates.io Implements Trusted Publishing Support
Crates.io adds Trusted Publishing support, enabling secure GitHub Actions-based crate releases without long-lived API tokens.
When called, the importance
function shuffles each feature n
times and computes the difference between the base score (calculated with original features X
and target variable y
) and permuted data. Intuitively that measures how the performance of a model decreases when we "remove" the feature.
// Create and train a model first
const rf = new RandomForestRegressor({
maxDepth: 20,
nEstimators: 50
})
rf.train(X, y)
// Get feature importance
const imp = importance(rf, X, y, {
kind: 'mse',
n: 10,
means: true,
verbose: false
})
console.log(impsRF)
You can also check example.js
in this repo that uses the random-forest package as a predictive model.
importance(model, X, y, options)
model
- trained model with predict
method (predictProba
if cross-entropy used as score)X
- 2D array of featuresy
- 1D array of target variablesOptions:
kind
- scoring function (mse
, mae
, rmse
, smape
, acc
, ce
(cross-entropy)n
- number of times each feature is shuffled.means
- if true
returns only average importanceverbose
- if true
throws some info into consoleFeature importance is often used for variable selection. Permutation-based importance is a good method for that goal, but if you need more robust selection method check boruta.js
The importance
package is used for feature selection on StatSim Select and for data visualization on StatSim Vis
FAQs
Permutation feature importance
The npm package importance receives a total of 15 weekly downloads. As such, importance popularity was classified as not popular.
We found that importance demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Crates.io adds Trusted Publishing support, enabling secure GitHub Actions-based crate releases without long-lived API tokens.
Research
/Security News
Undocumented protestware found in 28 npm packages disrupts UI for Russian-language users visiting Russian and Belarusian domains.
Research
/Security News
North Korean threat actors deploy 67 malicious npm packages using the newly discovered XORIndex malware loader.