Package: scikit-psl
Probabilistic Scoring ListsProbabilistic scoring lists are incremental models that evaluate one feature of the dataset at a time.
PSLs can be seen as a extension toscoring systemsin two ways:they can be evaluated at any stage allowing to trade of model complexity and prediction speed.they provide probablistic predictions instead of determnistic decisions for each possible score.Scoring Systems are used as decision support for human experts in medical or law domains.This implementation adheres to thesklearn-api.Installpipinstallscikit-pslUsageFor examples have a look at theexamplesfolder, but here is a simple examplefromsklearn.datasetsimportmake_classificationfromsklearn.model_selectionimporttrain_test_splitfromskpslimportProbabilisticScoringList# Generating synthetic data with continuous features and a binary target variableX,y=make_classification(n_informative=10,random_state=42)X_train,X_test,y_train,y_test=train_test_split(X,y,test_size=.2,random_state=42)psl=ProbabilisticScoringList({-1,1,2})psl.fit(X_train,y_train)print(f"Brier score:{psl.score(X_test,y_test,-1):.4f}")"""Brier score: 0.2438  (lower is better)"""df=psl.inspect(5)print(df.to_string(index=False,na_rep="-",justify="center",float_format=lambdax:f"{x:.2f}"))"""Stage Threshold  Score  T = -2  T = -1  T = 0  T = 1  T = 2  T = 3  T = 4  T = 50            -     -       -       -   0.51      -      -      -      -      -1     >-2.4245  2.00       -       -   0.00      -   0.63      -      -      -2     >-0.9625 -1.00       -    0.00   0.00   0.48   1.00      -      -      -3      >0.4368 -1.00    0.00    0.00   0.12   0.79   1.00      -      -      -4     >-0.9133  1.00    0.00    0.00   0.12   0.12   0.93   1.00      -      -5      >2.4648  2.00    0.00    0.00   0.07   0.07   0.92   1.00   1.00   1.00"""ChangelogAll notable changes to this project will be documented in this file.The format is based onKeep a Changelog,
and this project adheres toSemantic Versioning.0.6.2 - 2024-02-01AddedPSL supports instance weights0.6.1 - 2023-12-15AddedExtended precision at recall function0.6.0 - 2023-12-07AddedSignificantly extended the configuration capabilities with predefined features to limit the PSLs searchspaceChangedPSL global loss defaults to sum(cascade)rewrote/extracted expected entropy calculationFixedPSL inspect is now more robust0.5.1 - 2023-11-24FixedPSL classifier optimization regarding global loss was incorrect0.5.0 - 2023-11-16Added_ClassifierAtKSigmoid calibration additional to isotonicPSL classifierMake optimization loss configurableSmallsearchspace_analyisis(·)function makes lookahead choice more informedFixedFixed lookahead search space and considering global loss for model-sequence evaluationChangedUpdated dependencies and added blackMoved Binarizer to different moduleMoved PSL hyperparameters to constructor0.4.2 - 2023-11-09Fixed_ClassifierAtKExpected entropy for stage 0 now also calculated wrt. base 2Data with only 0 or 1 is now also interpret as binary data0.4.1 - 2023-10-19FixedSmall import error0.4.0 - 2023-10-17AddedAdd brute force threshold optimization method to find the global optimum, bisect optimizer remains default methodChangedRestructured source files0.3.1 - 2023-09-12FixedPSL is now correctly handles when all instances belong to the negative class#1if the first feature is assigned a negative score, it is now assigned the most negative score0.3.0 - 2023-08-10AddedPSL classifier can now run with continuous data and optimally (wrt. expected entropy) select thresholds to binarize
the dataChangedSignificantly improved optimum calculation for MinEntropyBinarizer (the same optimization algorithm is shared with the
psls internal binarization algorithm)0.2.0 - 2023-08-10AddedPSL classifierintroduced parallelizationimplemented l-step lookaheadsimple inspect(·) method that creates a tabular representation of the model0.1.0 - 2023-08-08AddedInitial implementation of the PSL algorithm