Skip to main content

will help in getting the correct classification model

Project description

Classification.Weighted_Ensemble(Models,X_train,y_train,X_val,y_val,X_test,y_test,Method=’SLSQP’)

Any classification model or an average Ensembling model combines the prediction from each model equally and often results in better performance on average than a given single model.

Weighted Ensemble model is an approach that allows multiple models to contribute to a prediction in proportion to their trust or estimated performance.

Using this above mentoined Weighted_Ensemble class You can predict single model as well as multiple models Which will give the clarity about the weightage of the model with respect to inputs

Parameters: Models==List of the model objects that you wanted to Predict X_train==Traininig dataset y_train==Training label dataset x_val==Validation data set Y_val==Validation labels dataset #X_val and y_Val are used to calculate the weights of the model objects that are there in the Models List NOte:The sum of the weights of the modes mentioned in the object are always equal to 1 x_test==Testing dataset to calculate the metric score Y_test==Testing label dataset to calculate the metric score

Example in the code declare models=[] Model1: rf=Randomclassifier() models.append(rf)

Model2: xgb=XGBClassifier() models.append(xgb)

result,weights=Weighted_Ensemble(Models,X_train,y_train,X_val,y_val,X_test,y_test,Method=’SLSQP’)

Result is a data frame which is something like below threshold tp fp tn fn accuracy precision recall scope f1 fpr Threshold values range from o.1 to 0.99 Weights are the list of values that shows how much weightage it has given to the model We can compare the values and pick the model very easily

Classification.get_metric_score(y_true, y_proba): If we have model already in hand we can call this method to observe the perfomance of the model with various thershold values Result is a data frame which is something like below threshold tp fp tn fn accuracy precision recall scope f1 fpr Threshold values range from o.1 to 0.99

Parameters: y_true==actual y values y_proba==We should give the probability values with respect to the predcition once

Example: y_true is the actual values Y_proba=np.round(model.predict_proba(X_test)[:,1],3) result_df=get_metric_score(y_true, y_proba)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

WeightedEnsemble-1.0.0-py3-none-any.whl (3.6 kB view details)

Uploaded Python 3

File details

Details for the file WeightedEnsemble-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: WeightedEnsemble-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 3.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.4.2 requests/2.21.0 requests-toolbelt/0.9.1 tqdm/4.28.1 CPython/3.7.1

File hashes

Hashes for WeightedEnsemble-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fdf7d7f326c2f620d5d0f68362ba33f0d8160890e2f8d3be5ceeee14bce6aa16
MD5 bd2fc119f1ccdc6f1d12130fac4a6e04
BLAKE2b-256 79a221041887e3143fd1708cb11c0242222dcaeef5549ad36a9b713af42ba660

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page