Skip to content

Instantly share code, notes, and snippets.

@thomasjpfan
Created January 16, 2020 20:58
Show Gist options
  • Select an option

  • Save thomasjpfan/a1550f8b3079f9563ecd3cd9a85dd734 to your computer and use it in GitHub Desktop.

Select an option

Save thomasjpfan/a1550f8b3079f9563ecd3cd9a85dd734 to your computer and use it in GitHub Desktop.
sklearn usage in nature articles
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"import pandas as pd"
]
},
{
"cell_type": "code",
"execution_count": 15,
"metadata": {},
"outputs": [],
"source": [
"df = pd.read_csv(\"sklearn_medical.csv\")"
]
},
{
"cell_type": "code",
"execution_count": 17,
"metadata": {},
"outputs": [],
"source": [
"modules = df[\"What is used?\"]"
]
},
{
"cell_type": "code",
"execution_count": 18,
"metadata": {},
"outputs": [],
"source": [
"from collections import Counter"
]
},
{
"cell_type": "code",
"execution_count": 19,
"metadata": {},
"outputs": [],
"source": [
"items = Counter(modules.map(lambda x: x.split(\", \")).agg('sum'))"
]
},
{
"cell_type": "code",
"execution_count": 23,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[('RF', 64),\n",
" ('SVM', 49),\n",
" ('LR', 36),\n",
" ('PCA', 29),\n",
" ('GridS', 20),\n",
" ('TSNE', 16),\n",
" ('AUC', 15),\n",
" ('KNN', 13),\n",
" ('KMeans', 12),\n",
" ('MLP', 11),\n",
" ('metrics', 10),\n",
" ('StandardScaler', 8),\n",
" ('GBT', 7),\n",
" ('Lasso', 6),\n",
" ('NB', 6),\n",
" ('DBSCAN', 6),\n",
" ('Tree', 6),\n",
" ('ElasticNet', 5),\n",
" ('MDS', 5),\n",
" ('Pipeline', 5),\n",
" ('AffinityProp', 5),\n",
" ('LASSO', 5),\n",
" ('cross_val_score', 4),\n",
" ('GMM', 4),\n",
" ('Ridge', 4),\n",
" ('MinMaxScaler', 3),\n",
" ('SelectKBest', 3),\n",
" ('RFECV', 3),\n",
" ('StratifiedKFold', 3),\n",
" ('sihouette', 3),\n",
" ('preprocessing', 3),\n",
" ('LeaveOneOut', 3),\n",
" ('LDA', 3),\n",
" ('ShuffleSplit', 3),\n",
" ('ExtraTree', 3),\n",
" ('Vectorizer', 2),\n",
" ('SpectralClustering', 2),\n",
" ('LOO', 2),\n",
" ('RobustScaler', 2),\n",
" ('FastICA', 2)]"
]
},
"execution_count": 23,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"items.most_common(40)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.5"
}
},
"nbformat": 4,
"nbformat_minor": 4
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment