Giter Club home page Giter Club logo

simple_ml_api's Introduction

University Ranking Prediction

This project demonstrates the process of building a machine learning model to predict university rankings based on various features. Additionally, it provides a FastAPI-based API for making predictions with the trained model.

API Endpoint:https://simple-ml-api-4b6b50e31b43.herokuapp.com/

Send a POST request with the following JSON object to get predictions:

{ "no_of_student":32000, "no_of_student_per_staff":23.5, "international_student":0.15, "teaching_score":97.4, "research_score":96.8, "citations_score":92.5, "industry_income_score":94.3, "international_outlook_score":97.1, "female_ratio":52.5, "male_ratio":47.5 }

Table of Contents

Overview

The goal of this project is to predict university rankings using machine learning. The steps involved in this project include:

  1. Data Preprocessing: The project starts with data preprocessing. The dataset, "World University Rankings 2023.csv," is loaded and cleaned to remove missing values and format columns correctly.
  2. Model Training: A Linear Regression model is trained on the preprocessed dataset. The model is used to predict university rankings based on features like the number of students, teaching scores, research scores, etc.
  3. Scalability: The StandardScaler is used to standardize the input features for making predictions.
  4. API Development: The FastAPI framework is used to create a simple API for university ranking predictions. The API takes input in the form of a JSON object, processes it, and returns a prediction.

Getting Started

Prerequisites

Before running this project, ensure you have the following prerequisites:

  • Python 3.x
  • Jupyter Notebook (optional)
  • Heroku CLI (optional for deployment)

Installation

  1. Clone the repository:
    bashCopy code
    git clone https://github.com/StevenHHB/simple_ml_api.git
  2. Install the required Python packages:
    bashCopy code
    pip install -r requirements.txt

Data Preprocessing and Model Training

  1. Data Preprocessing: The data preprocessing step is essential to clean and format the dataset. It involves handling missing values, converting data types, and creating appropriate features. This is done in the preprocess_data function.
  2. Model Training: The machine learning model, a Linear Regression model, is trained on the preprocessed dataset. This model is used to predict university rankings. You can find the code for training the model in a Jupyter Notebook or Python script.
  3. Standardization: Input features are standardized using the StandardScaler to ensure consistency when making predictions.
  4. Model Persistence: Both the trained model and the scaler are saved to pickle files (university_ranking_model.pkl and university_ranking_scaler.pkl, respectively) for later use.

API Usage

Once the model and scaler are trained and saved, you can start the FastAPI-based API to make university ranking predictions.

  1. Run the FastAPI application:
    bashCopy code
    uvicorn api:app --host 0.0.0.0 --port 8000 --reload
  2. Access the API at http://localhost:8000 using an API client or a tool like curl.
  3. Send a POST request with the following JSON object to get predictions:
    jsonCopy code
    { "no_of_student": 32000, "no_of_student_per_staff": 23.5, "international_student": 0.15, "teaching_score": 97.4, "research_score": 96.8, "citations_score": 92.5, "industry_income_score": 94.3, "international_outlook_score": 97.1, "female_ratio": 52.5, "male_ratio": 47.5 }
  4. You will receive a JSON response with the prediction:
    jsonCopy code
    { "predictions": 15.23 }

Contributing

Contributions are welcome! If you'd like to improve this project or fix any issues, please submit a pull request. For major changes, please open an issue first to discuss the proposed changes.

License

This project is licensed under the MIT License - see the LICENSE file for details.

simple_ml_api's People

Contributors

stevenhhb 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.