Code Monkey home page Code Monkey logo

pumisvm's Introduction

Positive and Unlabeled Multi-Instance Support Vector Machine (PUMISVM)

This repository contains a collection of Python scripts implementing the Positive and Unlabeled Multi-Instance Support Vector Machine (PUMISVM) model and its experiments on synthetic and Chest X-Ray PU multi-instance datasets. It covers data creation, building baseline models, reporting classification performance metrics, and visualizing the results.

Project Description

  • run.py: Imports baseline models from kenchi, pyod, sklearn, and our PUMISVM model. Configures parameters, creates the Positive and Unlabeled Multi-Instance dataset, splits the dataset, conducts PU learning and classification, and reports results in terms of accuracy, precision, recall, F1 score, and balanced accuracy.
  • utils.py: Contains utility functions for experiments, processes raw chest X-ray data, creates the multi-instance dataset for PU learning, and includes visualization code for plotting important instances identified by the PU learning model.
  • PUMISVM.py: Implements the PUMISVM model, featuring the class PUMISVM with three key methods: init, fit, and predict. The init method defines the hyperparameters of PUMISVM. The fit method takes the multi-instance training data X and its associated grouping information y (with ungrouped bags marked as 'unlabeled'). The predict method also takes multi-instance data X and their grouping information, outputting decisions where 1 indicates an inlier and -1 indicates an outlier for the bags in X.
  • other_models.py: Includes baseline Positive and Unlabeled (PU) learning or outlier detection models for comparison. Contains wrappers for sklearn, kenchi, and pyod models, with each wrapper defining the fit and predict methods to consistently output 1 for inliers and -1 for outliers from multi-instance data.

Getting Started

Dependencies

  • Python 3.9.16
  • Python packages listed in requirements.txt

Installation

To set up the project, start by cloning the repository to your local machine. It is highly recommended to create an isolated Python environment via conda. For example:

conda create -n "PUMISVM" python=3.9

Then, activate the created environment:

conda activate "PUMISVM"

Next, install the required packages:

pip install requirements.py

Running the tests

After installing the packages, you can conduct the experiments by running:

python3 run.py

A folder will be created under the 'output_path' in run.py, containing all the experimental results.

Data

The necessary data for executing the framework's scripts is readily accessible in the Chest X-ray dataset repository. Clone this repository to your local machine and specify the path to the cloned dataset in run.py.

Contributing

We welcome contributions to improve the framework and extend its functionalities. Please feel free to fork the repository, make your changes, and submit a pull request.

pumisvm's People

Contributors

hoonseo0409 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.