Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7407825
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T05:47:46+00:00 2026-05-29T05:47:46+00:00

I fit a Logistic Regression Model and train the model based on training dataset

  • 0
  • I fit a Logistic Regression Model and train the model based on training dataset using the following
import scikits as sklearn
from sklearn.linear_model import LogisticRegression
lr = LogisticRegression(C=0.1, penalty='l1')
model = lr.fit(training[:,0:-1], training[:,-1)
  • I have a cross validation dataset which contains a labels associated in input matrix and can be accessed as

cv[:,-1]

  • I run my cross validation dataset against the trained model which returns me the list of 0s and 1s based on prediction

cv_predict = model.predict(cv[:,0:-1])

Question

I want to calculate the precision and recall scores based on acutal labels and predicted labels. Is there a standard method to do it using numpy/scipy/scikits?

Thank you

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T05:47:47+00:00Added an answer on May 29, 2026 at 5:47 am

    Yes there are, see the documentation: http://scikit-learn.org/stable/modules/classes.html#classification-metrics

    You should also have a look at the sklearn.metrics.classification_report utility:

    >>> from sklearn.metrics import classification_report
    >>> from sklearn.linear_model import SGDClassifier
    >>> from sklearn.datasets import load_digits
    
    >>> digits = load_digits()
    >>> n_samples, n_features = digits.data.shape
    >>> n_split = n_samples / 2
    
    >>> clf = SGDClassifier().fit(digits.data[:n_split], digits.target[:n_split])
    
    >>> predictions = clf.predict(digits.data[n_split:])
    >>> expected = digits.target[n_split:]
    
    >>> print classification_report(expected, predictions)
                 precision    recall  f1-score   support
    
              0       0.90      0.98      0.93        88
              1       0.81      0.69      0.75        91
              2       0.94      0.98      0.96        86
              3       0.94      0.85      0.89        91
              4       0.90      0.93      0.91        92
              5       0.92      0.92      0.92        91
              6       0.92      0.97      0.94        91
              7       1.00      0.85      0.92        89
              8       0.71      0.89      0.79        88
              9       0.89      0.83      0.86        92
    
    avg / total       0.89      0.89      0.89       899
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want do fit some sort of multi-variate time series model using R. Here
I am try to fit an eGARCH model on an expanding basis using the
I'm trying to fit a logistic growth curve to my data using curve_fit using
I have fit a regression using lme4 thanks to a previous answer . Now
I want to fit a power function to a dataset. I'm using this method:
I'm trying to make this logistic regression graph in ggplot2 . df <- structure(list(y
Consider a nonlinear least squares model in R, for example of the following form):
I fit a count model to a vector of actual data and would now
I want to fit a curve using the lsqcurvefit function. It is something like
I need to fit some points from different datasets with straight lines. From every

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.