Package: classgraphic
classgraphicInteractive classification diagnostic plots for scikit-learn.We classify things for the purpose of doing something to them. Any classification which does not assist manipulation is worse than useless. - Randolph S. Bourne,
"Education and Living", The Century Co (April 1917)Major features:Plotly based tables for:class_imbalance_tableclassification_tableconfusion_matrix_tabledescribe (dataframe stats)prediction_tabletableAnd the following charts:class_imbalanceclass_errordetfeature_importancemissingprecision_recallrocprediction_histogramthresholdFor clustering:Delauney triangulationsVoronoi tessalationsTry itBy trying it on binder, you'll see all the details and interactivity. The quickstart below
has static images, but if you run these commands in a jupyter notebook, ipython or IDE you will
be able to interact with them.Quickstartfromclassgraphic.essentialimport*# loading the datadf=px.data.iris()# let's see what kind of data we havedescribe(df,transpose=True).show()# any missing?missing(df)# featuresX=df.drop(columns=["species","species_id"])#targety=df["species"]# Let's check our classes we will be training on and predictingclass_imbalance_table(y,condition="all")# train / test splitX_train,X_test,y_train,y_test=train_test_split(X,y,test_size=0.5,random_state=random_state)# we want to see total count for each, default for bars is to be stacked, so that works# we could also pass to class_imbalance barmode="overlay" if we preferclass_imbalance(y_train,y_test,condition="train,test")# modelmodel=LogisticRegression(max_iter=max_iter,random_state=random_state)model.fit(X_train,y_train)# predictionsy_score=model.predict_proba(X_test)y_pred=model.predict(X_test)confusion_matrix_table(model,y_test,y_pred).show()classification_table(model,y_test,y_pred)feature_importance(model,y,transpose=True)This concludes the quickstart. There are many more visualizations and tables to explore.See thenotebooksanddocsfolders ongithuband the documentationweb sitefor more information.RequirementsPython 3.8 or laternumpypandasplotly>=5.0scikit-learnnbformatInstallIf you use conda, create an environment namedclassgraphic, then activate it:in Linux:source activate pilotIn Windows:conda activate pilotIf you use another environment management create and activate your environment
using the normal steps.Then execute:pythonsetup.pyinstallor for installing indevelopment mode:python-mpipinstall-e.--no-build-isolationor alternativelypythonsetup.pydevelopTo install from github instead:pipinstallgit+https://github.com/dionresearch/classgraphicSee alsostemgraphicpython package for visualization of data and textHotellingone and two sample Hotelling T2 tests, T2 and f statistics and univariate and multivariate control charts and anomaly detectionHistory0.3.1 (2023-09-20)bugfix for describe with pandas 2.x0.3.0 (2023-05-01)added 2D clustering visualizationdefaults to Voronoi tessalationoptional Delauney triangulation0.2.1 (2022-09-20)fixed image not showing on pypifixed feature importance errorwarning = False didn't prevent warning to show0.2.1 (2022-09-19)added binary classification notebook examplefixed issue with non dataframe binary classification0.2.0 (2022-09-18)The previous version was a first step to doing a public release. This
release added:documentedupdated the code to be in line with plotly 5.xIt was released togithuband pypy.0.1.0 (2019-10-27)First private releaseOriginsInspired by Dion Research LLC Internal EDA/anomaly and end to end data science platform.
A dozen charts and tables were initially designed to provide better diagnostic reporting.
Some can also be used for exploratory or explanatory purposes.See:https://blog.dionresearch.com/2019/10/visualizations-explanatory-exploratory.html