Skip to content

Instantly share code, notes, and snippets.

@khanhnamle1994
Created December 17, 2019 16:04
Show Gist options
  • Select an option

  • Save khanhnamle1994/670a6aed82286b48a50a05ff311c01ce to your computer and use it in GitHub Desktop.

Select an option

Save khanhnamle1994/670a6aed82286b48a50a05ff311c01ce to your computer and use it in GitHub Desktop.
Second Code Snippet For CatBoost Article
# Transform a count matrix to a normalized tf or tf-idf representation
transformer = TfidfTransformer()
# Fit to data matrices, then transform them
data_1 = transformer.fit_transform(data_cor1)
data_2 = transformer.fit_transform(data_cor2)
# Create a new column from these values
data['cor1_Tfidf'] = np.mean(data_1, 1)
data['cor2_Tfidf'] = np.mean(data_2, 1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment