Question

I’m new to ML with scikit on jupyter notebook, so i was wondering after you train...

I’m new to ML with scikit on jupyter notebook, so i was wondering after you train a classifier from your original dataset that was split into train and test dataset, how do I test a completely new dataset to this previously trained classifier?
0 0
Add a comment Improve this question Transcribed image text
Answer #1

If you want to convert an existing Python function into a transformer to assist in data cleaning or processing. You can implement a transformer from an arbitrary function with FunctionTransformer. For example, to build a transformer that applies a log transformation in a pipeline, do:

>>> import numpy as np
>>> from sklearn.preprocessing import FunctionTransformer
>>> transformer = FunctionTransformer(np.log1p, validate=True)
>>> X = np.array([[0, 1], [2, 3]])
>>> transformer.transform(X)
array([[0. , 0.69314718],
[1.09861229, 1.38629436]])

You can ensure that func and inverse_func are the inverse of each other by setting check_inverse=True and calling fit before transform. Please note that a warning is raised and can be turned into an error with a filterwarnings:


>>> import warnings
>>> warnings.filterwarnings("error", message=".*check_inverse*.",
... category=UserWarning, append=False)

Now you can again load new dataset :

Let’s load the dataset using pandas.

>>> data=pd.read_csv('newdataset.csv')
>>> data.head()

Add a comment
Know the answer?
Add Answer to:
I’m new to ML with scikit on jupyter notebook, so i was wondering after you train...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • For Jupyter Notebook we have opened up a file using pandas but I am confused on...

    For Jupyter Notebook we have opened up a file using pandas but I am confused on this question and how to do it. Create a new dataframe that only contains the data where fuel is “regular” AND MPG is over 21. Call it Auto_sub. Label each section using markup to state what you are doing and what you see

  • Can you please show me how to do this problem so I can see if I’m...

    Can you please show me how to do this problem so I can see if I’m correct or not ?? Also can you draw the graph as well. Thank you ! 口山 Untitled (Draft) Untitied Notebook 3 Pesiion vs Hin gropn sdawn or a ooau moving in one tu speed uast? 2-4 4 speud atlowest pointis O2

  • Classification in Python: Classification In this assignment, you will practice using the kNN (k-Nearest Neighbors) algorithm...

    Classification in Python: Classification In this assignment, you will practice using the kNN (k-Nearest Neighbors) algorithm to solve a classification problem. The kNN is a simple and robust classifier, which is used in different applications. The goal is to train kNN algorithm to distinguish the species from one another. The dataset can be downloaded from UCI Machine Learning Repository: https://archive.ics.uci.edu/ml/machine-learning-databases/iris/ (Links to an external site.)Links to an external site.. Download `iris.data` file from the Data Folder. The Data Set description...

  • I do resonate with the time value of money concept. “Money that you have in had...

    I do resonate with the time value of money concept. “Money that you have in had today can be invested to earn a positive rate of return, producing more money tomorrow”. Right now, I’m only contributing 2% of my wages towards retirement. I’m wondering if I should be contributing more. People are always talking about social security running out so if it’s affordable, is there a suggested rate to contribute? Your answers must provide clear evidence of critical thinking.  Your answer...

  • if you could write out how you solved so i can understand how to actually do...

    if you could write out how you solved so i can understand how to actually do it/where i went wrong thank you so much! 1. A standard solution of NaOH is formed by weighing 4.000 g of NaOH and dissolving it in water to make a total of 200.0 ml of solution. This solution is then used to titrate a solution of HCl(aq) of unknown concentration to an endpoint. The endpoint is reached after the addition of 52.67 ml of...

  • Hello. i am very stumped on this question. i was wondering if you can help! thank...

    Hello. i am very stumped on this question. i was wondering if you can help! thank you so much Q1 - 14 marks An analyst at a local bank wonders if the age distribution of customers coming for service at his branch in town is the same as at the branch located near the mall. He selects 100 transactions at random from each branch and researches the age information for the associated customer. Here are the data: Age 30-35 Less...

  • Use the link in the Jupyter Notebook activity to access your Python script. Once you have...

    Use the link in the Jupyter Notebook activity to access your Python script. Once you have made your calculations, complete this discussion. The script will output answers to the questions given below. You must attach your Python script output as an HTML file and respond to the questions below. In this discussion, you will apply the statistical concepts and techniques covered in this week's reading about hypothesis testing for the difference between two population proportions. In the previous week’s discussion,...

  • In the second image it states that after I pass the equivalence point, I should add...

    In the second image it states that after I pass the equivalence point, I should add 2ml of aliquots of NaOH until there's no PH change. How do I identify when the equivalence point is? Preparation of the unknown weak acid Select the NaOH and fill the buret with the now standardized NaOH solution. [NaOH]=0.097M Record the initial buret volume in your Notebook. 3 Using the volumetric pipet, transfer 25.00 mL of the unknown weak acid to the Erlenmeyer flask....

  • I’m horrible with probabilities so please help me and also show work so I could understand...

    I’m horrible with probabilities so please help me and also show work so I could understand them Part A Suppose you toss a coin and it lands flat on the table. There are two possible final states for the coin, it can land with heads up or tails up. Now consider tossing three coins, one after the other. How many different arrangements are possible? Hint: Four of the possible arrangements are shown below. H HT HTH THH Part B We...

  • 4. Train for Scooby. Organizations such as PETA struggle to tackle the deficiency of competent trainers...

    4. Train for Scooby. Organizations such as PETA struggle to tackle the deficiency of competent trainers by employing uncertified trainers in dog hounds with critical needs often in remote areas. A 2019 study compared - r-old dogs trained by certified trainers with others trained by under-certified trainers in the same remote areas. Obedience of under-certified trainers averaged 36.52 points with standard deviation 9.31. The obedience of 2-yr-old logs trained by certified trainers had mean 32.48 points with standard deviation 9.43...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT