GithubHelp home page GithubHelp logo

shreyashsomvanshi / machine-hack-practice-problems Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 0.0 228 KB

Machine Hack Problems

Home Page: https://machinehack.com/user/63e66c416018ef32de78c4d0

License: MIT License

Python 100.00%
machinehack pythonpractice pythonprogramming

machine-hack-practice-problems's Introduction

machine-hack-practice-problems's People

Contributors

shreyashsomvanshi avatar

Stargazers

 avatar  avatar

Watchers

 avatar

machine-hack-practice-problems's Issues

Wrong output!

Arrays/#82. Difference between the mean and median of two sorted arrays
incorrect output .

Next easy problem - 907. Evaluate classification model performance.py

'''
You are given a list of ground truth labels y_true_list and a list of predicted labels y_pred_list for multiple classes.
Write a function that takes these two lists as input and returns a pandas DataFrame containing evaluation metrics for each class.
The function should calculate the ROC AUC score, precision, and recall for each class. The input lists may contain multiple elements,
each corresponding to a different class. The function should return a DataFrame with one row per class and three columns containing the
evaluation metrics.

Example 1:

Input:
y_true_list = [[0, 1, 1, 0, 1],
[1, 1, 0, 0],
[0, 0, 1, 1, 0, 1]]
y_pred_list = [[0, 1, 0, 0, 1],
[1, 1, 1, 0],
[0, 0, 1, 0, 1, 1]]

Output:

ROC AUC Score Precision Recall
0 0.833333 0.866667 0.800000
1 0.750000 0.833333 0.750000
2 0.666667 0.666667 0.666667

Example 2:

Input:

y_true_list = [[1, 0, 0, 1, 1],
[0, 1, 0, 1],
[1, 1, 0, 0, 1, 0]]
y_pred_list = [[1, 0, 1, 1, 1],
[0, 1, 0, 0],
[1, 0, 0, 1, 1, 1]]
Output:

ROC AUC Score Precision Recall
0 0.75 0.850000 0.80
1 0.75 0.833333 0.75
2 0.50 0.500000 0.50

Constraints: The output should be in the pandas DataFrame.

'''

Solution:

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.