セクション 3. 章 8
single
Challenge: TF-IDF
メニューを表示するにはスワイプしてください
タスク
スワイプしてコーディングを開始
You have a text corpus stored in corpus variable. Your task is to display the vector for the 'medical' unigram in a TF-IDF model with unigrams, bigrams, and trigrams. To do this:
- Import the
TfidfVectorizerclass to create a TF-IDF model. - Instantiate the
TfidfVectorizerclass astfidf_vectorizerand configure it to include unigrams, bigrams, and trigrams. - Use the appropriate method of
tfidf_vectorizerto generate a TF-IDF matrix from the'Document'column in thecorpusand store the result intfidf_matrix. - Convert
tfidf_matrixto a dense array and create aDataFramefrom it, setting the unique features (terms) as its columns. Store the result in thetfidf_matrix_dfvariable. - Display the vector for
'medical'as an array.
解答
すべて明確でしたか?
フィードバックありがとうございます!
セクション 3. 章 8
single
AIに質問する
AIに質問する
何でも質問するか、提案された質問の1つを試してチャットを始めてください