Skip to content

Instantly share code, notes, and snippets.

@arogozhnikov
Created March 16, 2015 19:18
Show Gist options
  • Save arogozhnikov/16c64461113e5342ebbe to your computer and use it in GitHub Desktop.
Save arogozhnikov/16c64461113e5342ebbe to your computer and use it in GitHub Desktop.
{
"metadata": {
"name": "",
"signature": "sha256:029e6d75e1a5bcd05ac659251fefd2b5420dbe5f5b1aa26b34bd5472d5097e80"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
"cell_type": "code",
"collapsed": false,
"input": [
"%pylab inline"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"Populating the interactive namespace from numpy and matplotlib\n"
]
}
],
"prompt_number": 1
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"from rep.estimators import TMVAClassifier"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 2
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"# pay attention to efficiency\n",
"clf = TMVAClassifier('kCuts', sigmoid_function='sig_eff=0.4', FitMethod='GA')"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 3
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"from sklearn.datasets import make_blobs"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 4
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"X, y = make_blobs(n_samples=1000, n_features=4, centers=2)"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 5
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"clf.fit(X, y)"
],
"language": "python",
"metadata": {},
"outputs": [
{
"metadata": {},
"output_type": "pyout",
"prompt_number": 6,
"text": [
"TMVAClassifier(FitMethod='GA',\n",
" factory_options='!V:!Silent:Color:Transformations=I;D;P;G,D:AnalysisType=Classification',\n",
" features=['Feature_0', 'Feature_1', 'Feature_2', 'Feature_3'],\n",
" method='kCuts')"
]
}
],
"prompt_number": 6
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"# will be zeros and ones\n",
"p = clf.predict_proba(X)"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 7
}
],
"metadata": {}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment