Closed manics closed 10 years ago
Adds a cross-validation script, based on https://github.com/wnd-charm/wnd-charm/blob/master/examples/classifier_cross_validation.py, see #18.
Requires wnd-charm/wnd-charm#26
Note the cross validation script is curently broken:
In [17]: e.PredictedValueAnalysis() --------------------------------------------------------------------------- TypeError Traceback (most recent call last) <ipython-input-17-8ed307c64bfa> in <module>() ----> 1 e.PredictedValueAnalysis() /Users/simon/omero-test/venv/lib/python2.7/site-packages/pychrm-0.2-py2.7-macosx-10.8-x86_64.egg/pychrm/FeatureSet.pyc in print_method_wrapper(*args, **kwargs) 201 sys.stdout = backup 202 else: --> 203 retval = method_that_prints_output( *args, **kwargs ) 204 return retval 205 /Users/simon/omero-test/venv/lib/python2.7/site-packages/pychrm-0.2-py2.7-macosx-10.8-x86_64.egg/pychrm/FeatureSet.pyc in PredictedValueAnalysis(self) 4062 vals = np.array( [result.predicted_value for result in self.accumulated_individual_results[filename] ]) 4063 self.ground_truth_values.append( self.accumulated_individual_results[filename][0].ground_truth_value ) -> 4064 self.predicted_values.append( np.mean(vals) ) 4065 self.individual_stats[filename] = ( len(vals), np.min(vals), np.mean(vals), \ 4066 np.max(vals), np.std(vals) ) /usr/local/lib/python2.7/site-packages/numpy/core/fromnumeric.pyc in mean(a, axis, dtype, out, keepdims) 2486 2487 return _methods._mean(a, axis=axis, dtype=dtype, -> 2488 out=out, keepdims=keepdims) 2489 2490 /usr/local/lib/python2.7/site-packages/numpy/core/_methods.pyc in _mean(a, axis, dtype, out, keepdims) 55 out=ret, casting='unsafe', subok=False) 56 else: ---> 57 ret = ret / float(rcount) 58 return ret 59 TypeError: unsupported operand type(s) for /: 'NoneType' and 'float'
@colettace This is based on the cross-validation script you suggested, on my test data PredictedValueAnalysis() throws an error (which is why I've temporarily put a try-catch around it).
PredictedValueAnalysis()
Adds a cross-validation script, based on https://github.com/wnd-charm/wnd-charm/blob/master/examples/classifier_cross_validation.py, see #18.
Requires wnd-charm/wnd-charm#26
Note the cross validation script is curently broken: