Package: backwardcompatibilityml
IntroductionUpdates that may improve an AI system’s accuracy can also introduce new
and unanticipated errors that damage user trust. Updates that introduce
new errors can also break trust between software components and machine
learning models, as these errors are propagated and compounded
throughout larger integrated AI systems. The Backward Compatibility ML
library is an open-source project for evaluating AI system updates in a
new way for increasing system reliability and human trust in AI
predictions for actions.The Backward Compatibility ML project has two components:A series of loss functionsin which users can vary the weight
assigned to the dissonance factor and explore performance/capability
tradeoffs during machine learning optimization.Visualization widgetsthat help users examine metrics and error
data in detail. They provide a view of error intersections between
models and incompatibility distribution across classes.Getting StartedSetup a Python virtual environment or Conda environment and activate it.From within the root folder of this project dopip install -r requirements.txtFrom within the root folder donpm installFrom within the root folder of this project donpm run build && pip install -e .orNODE_ENV=production npx webpack && pip install -e .You should now be able to import thebackwardcompatibilitymlmodule and use it.ExamplesStart your Jupyter Notebooks server and load in the example notebook under theexamplesfolder
to see how thebackwardcompatibilitymlmodule is used.To demo the compatbility analysis widget, open the notebookcompatibility-analysis.ipynbinside the examples folder. Below is a list other sample notebooks that may be of interest. For the full list of example notebooks, please refer toRunning the Backward Compatibility ML library examplesNotebook nameFrameworkNotescompatibility-analysis-cifar10-resnet18-pretrainedPyTorchUses a pre-trained modelmodel-comparison-MNISTPyTorchUses ModelComparison widgettensorflow-new-error-cross-entropy-lossTensorFlowGeneral TensorFlow usage exampletensorflow-MNISTTensorFlowUses CompatibilityModel classMLflowCompatibility sweeps are automatically logged withMLflow. MLflow runs are logged in a folder namedmlrunsin the same directory as the notebook.
To view the MLflow dashboard, start the MLflow server by runningmlflow server --port 5200 --backend-store-uri ./mlruns. Then, open the MLflow UI
in your browser by navigating tolocalhost:5200.TestsTo run tests, make sure that you are in the project root folder and do:pip install -r dev-requirements.txtpytest tests/npm installnpm run testDevelopment EnvironmentThis is provided as a convenience tool to developers, in order to allow development of the widget proceed outside of a Jupyter notebook environment.The widget can be loaded in the web browser atlocalhost:3000or<your-ip>:3000. It will be loaded independently from a Jupyter notebook. The APIs will be hosted atlocalhost:5000or<your-ip>:5000.Changes to the CSS or TypeScript code will be hot loaded automatically in the browser. Flask will run in debug mode and automatically restart whenever the Python code is changed.Compatibility Analysis WidgetOpen a new terminal and within the project root folder doFLASK_ENV=development FLASK_APP=development/compatibility-analysis/app.py flask run --host 0.0.0.0 --port 5000on Linux orset FLASK_ENV=development && set FLASK_APP=development\compatibility-analysis\app.py && flask run --host 0.0.0.0 --port 5000on Windows. This will start the Flask server for the APIs used by the widget.Open a new terminal, then from within the project root folder donpm run start-compatibility-analysisOpen your browser and point it tohttp://<your-ip-address>:3000Model Comparison WidgetOpen a new terminal and within the project root folder doFLASK_ENV=development FLASK_APP=development/model-comparison/app.py flask run --host 0.0.0.0 --port 5000on Linux orset FLASK_ENV=development && set FLASK_APP=development\model-comparison\app.py && flask run --host 0.0.0.0 --port 5000on Windows. This will start the Flask server for the APIs used by the widget.Open a new terminal, then from within the project root folder donpm run start-model-comparison.Open your browser and point it tohttp://<your-ip-address>:3000ContributingCheckCONTRIBUTINGpage.Research and AcknowledgementsThis project materializes and implements ideas from ongoing research on Backward Compatibility in Machine Learning and Model Comparison. Here is a list of development and research contributors:Current Contributors:Xavier Fernandes,Nicholas King,Kathleen Walker,Juan Lema,Besmira NushiResearch Contributors:Gagan Bansal,Megha Srivastava,Besmira Nushi,Ece Kamar,Eric Horvitz,Dan Weld,Shital ShahReferences"Updates in Human-AI Teams: Understanding and Addressing the Performance/Compatibility Tradeoff."Gagan Bansal, Besmira Nushi, Ece Kamar, Daniel S Weld, Walter S Lasecki, Eric Horvitz; AAAI 2019.Pdf@inproceedings{bansal2019updates,
  title={Updates in human-ai teams: Understanding and addressing the performance/compatibility tradeoff},
  author={Bansal, Gagan and Nushi, Besmira and Kamar, Ece and Weld, Daniel S and Lasecki, Walter S and Horvitz, Eric},
  booktitle={Proceedings of the AAAI Conference on Artificial Intelligence},
  volume={33},
  pages={2429--2437},
  year={2019}
}"An Empirical Analysis of Backward Compatibility in Machine Learning Systems."Megha Srivastava, Besmira Nushi, Ece Kamar, Shital Shah, Eric Horvitz; KDD 2020.Pdf@inproceedings{srivastava2020empirical,
  title={An Empirical Analysis of Backward Compatibility in Machine Learning Systems},
  author={Srivastava, Megha and Nushi, Besmira and Kamar, Ece and Shah, Shital and Horvitz, Eric},
  booktitle={Proceedings of the 26th ACM SIGKDD International Conference on Knowledge Discovery \& Data Mining},
  pages={3272--3280},
  year={2020}
}"Towards Accountable AI: Hybrid Human-Machine Analyses for Characterizing System Failure."Besmira Nushi, Ece Kamar, Eric Horvitz; HCOMP 2018.Pdf@article{nushi2018towards,
  title={Towards accountable ai: Hybrid human-machine analyses for characterizing system failure},
  author={Nushi, Besmira and Kamar, Ece and Horvitz, Eric},
  journal={ Proceedings of the Sixth AAAI Conference on Human Computation and
               Crowdsourcing},
  pages = {126--135},
  year={2018}
}Microsoft Open Source Code of ConductThis project has adopted theMicrosoft Open Source Code of Conduct.
For more information see theCode of Conduct FAQor contactopencode@microsoft.comwith any additional questions or comments.LicenseThis project is licensed under the terms of the MIT license. SeeLICENSE.txtfor additional details.TrademarksThis project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft trademarks or logos is subject to and must followMicrosoft's Trademark & Brand Guidelines. Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. Any use of third-party trademarks or logos are subject to those third-party's policies.