Python Forum
How to test and import a model form computer to test accuracy using Sklearn library
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to test and import a model form computer to test accuracy using Sklearn library
#1
Which types of data model we can test
like which format don't know i have some model i want to check the accuracy using logistic regression for the accuracy
I download some models
where my task to predict feathers for the same model using Secure KNN algorithm
Looks at the below codes
# read in the iris data
from sklearn.datasets import load_iris
iris = load_iris()

# create X (features) and y (response)
X = iris.data
y = iris.target
# import the class
from sklearn.linear_model import LogisticRegression

# instantiate the model (using the default parameters)
logreg = LogisticRegression()

# fit the model with data
logreg.fit(X, y)

# predict the response values for the observations in X
logreg.predict(X)
# store the predicted response values
y_pred = logreg.predict(X)

# check how many predictions were generated
len(y_pred)
Reply
#2
score(x,y)

See Logistic Regression documentation
Anldra12 likes this post
Reply
#3
@jefsummers thanks not just for prediction read post how we apply others types of data set
Reply
#4
I can tell English is not your first language, but you are way better at English than I would be at your native language. I don't quite understand the question however.
Let me try to break it down, maybe by luck I will hit on what you are looking for -

Two types of data - continuous and categorical
Four types of predictions, then -
Continuous -> Continuous - use linear regression (or similar)
Continuous -> Categorical - use logistic regression
Categorical -> Continuous - use ANOVA (analysis of variance)
Categorical -> Categorical - use chi square

If this did not help please rephrase the question.
Reply
#5
@jefsummers quite simple let suppose we want to check others types of data model instead of Iris data
How we import this model for the predictions for example look at the codes as follow
This an iris data set but replace this model
from sklearn.datasets import load_iris
iris = load_iris() 
I replace iris to other model how this will happen just for an example
from sklearn.datasets import  Cancer_df
 Cancer = load_ Cancer_df() 
After that we apply your proposed model
Two types of data - continuous and categorical
Four types of predictions, then -
Continuous -> Continuous - use linear regression (or similar)
Continuous -> Categorical - use logistic regression
Categorical -> Continuous - use ANOVA (analysis of variance)
Categorical -> Categorical - use chi square
Reply
#6
It depends on how the model was created and stored. Here is the documentation from sklearn regarding saving and loading models https://scikit-learn.org/stable/modules/...tence.html

I recommend the interoperable formats mentioned at the bottom of the article rather than pickle, for the concerns that pickle is unique to Python and that arbitrary code execution is possible.
Reply
#7
@jefsummers yes i will look at this
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Presenting random test questions oradba4u 2 256 Sep-27-2022, 04:23 PM
Last Post: deanhystad
  How to sort .csv file test log which item first fail and paint color SamLiu 24 1,927 Sep-03-2022, 07:32 AM
Last Post: Pedroski55
  Help with bleak - how to send test to BLE device? korenron 1 399 Aug-28-2022, 11:28 PM
Last Post: Larz60+
  Statsmodels, Dickey-Fuller test for stationarity Led_Zeppelin 1 258 Aug-17-2022, 06:36 PM
Last Post: Larz60+
  Membership test for an element in a list that is a dict value for a particular key? Mark17 2 491 Jul-01-2022, 10:52 PM
Last Post: Pedroski55
  ImportError: /home/ali/Documents/test/charm/core/crypto/AES.cpython-39-x86_64-linux-g Anldra12 0 472 Apr-28-2022, 07:13 AM
Last Post: Anldra12
  can someone test the code for me kucingkembar 4 771 Feb-17-2022, 10:22 AM
Last Post: kucingkembar
  how do I return Max Test result + corresponding student name from an excel dataset? sean1 3 594 Jan-16-2022, 09:07 PM
Last Post: snippsat
  Install any library via pip get an error cannot import name 'SCHEME_KEYS' from 'pip. Anldra12 2 4,991 Jan-04-2022, 01:05 PM
Last Post: Anldra12
  How from sklearn.datasets import load_diabetes change to import to CSV file Anldra12 0 859 Dec-25-2021, 07:20 PM
Last Post: Anldra12

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020