in Education by
In the chapter seven of this book "TensorFlow Machine Learning Cookbook" the author in pre-processing data uses fit_transform function of scikit-learn to get the tfidf features of text for training. The author gives all text data to the function before separating it into train and test. Is it a true action or we must separate data first and then perform fit_transform on train and transform on test? JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
According to the documentation of scikit-learn, fit() is used in order to Learn vocabulary and idf from training set. On the other hand, fit_transform() is used in order to Learn vocabulary and idf, return term-document matrix. while transform() Transforms documents to document-term matrix. On the training set you need to apply both fit() and transform() (or just fit_transform() that essentially joins both operations) however, on the testing set you only need to transform() the testing instances (i.e. the documents). Remember that training sets are used for learning purposes (learning is achieved through fit()) while testing set is used in order to evaluate whether the trained model can generalise well to new unseen data points. For more details you can refer to the article fit() vs transform() vs fit_transform()

Related questions

0 votes
    Which of the following can be used to impute data sets based only on information in the training set? ... questions and answers pdf, Data Science interview questions for beginners...
asked Oct 28, 2021 in Education by JackTerrance
0 votes
    I'm using TensorFlow Alpha 2.0. I have TFRecords files I'm reading from, each one holding a short ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 26, 2022 in Education by JackTerrance
0 votes
    How can I divide data into training and validation sets, Should I divide it 50%-50% for both or is there another ... advice me on this? Select the correct answer from above options...
asked Jan 22, 2022 in Education by JackTerrance
0 votes
    A ______________ on the whole turns your system's NIC to the licentious mode so that it can listen to all ... -for-Cyber Security:,Cyber Security-Jobs:,Cyber Security Applications...
asked Oct 31, 2021 in Education by JackTerrance
0 votes
    I have bit a problem. I need insert to Array only (example) first array, best field by field. ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 26, 2022 in Education by JackTerrance
0 votes
    State true or false: SAP systems are divided into different clients depending on business requirement, the data can be accessed within the client only. A. True B. False...
asked Feb 20, 2023 in Technology by JackTerrance
0 votes
    Which of these methods return a smallest whole number greater than or equal to variable X? (a) double ... questions and answers pdf, java interview questions for beginners...
asked Oct 25, 2021 in Education by JackTerrance
0 votes
    Which of these method returns a largest whole number less than or equal to variable X? (a) double ... programming questions and answers pdf, java interview questions for beginners...
asked Oct 25, 2021 in Education by JackTerrance
0 votes
    In an application currently in production, one module of code is being modified. Is it necessary to re-test ... it enough to just test functionality associated with that module?...
asked Oct 17, 2020 in Technology by anonymous
0 votes
    If an expression contains double, int, float, long, then the whole expression will be promoted into which of ... questions and answers pdf, java interview questions for beginners...
asked Oct 28, 2021 in Education by JackTerrance
0 votes
    What is effect on neuron as a whole when its potential get raised to -60mv? (a) it get fired (b) no effect (c) it get compressed (d) it expands Please answer the above question....
asked Sep 21, 2022 in Education by JackTerrance
0 votes
    The delivery of a learning, training or educational program by electronic means is termed as …………………….. Select the correct answer from above options...
asked Dec 20, 2021 in Education by JackTerrance
0 votes
    Why should we avoid using the training data for evaluation? Please answer the above question....
asked Aug 23, 2022 in Education by JackTerrance
0 votes
    I've just started using R and I'm not sure how to incorporate my dataset with the following sample ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 26, 2022 in Education by JackTerrance
...