On Fri, Mar 15, 2013 at 9:05 AM,  <[email protected]> wrote:
> Dear ScikitLearners,
>
> I hope that I'm not too much off topic...
>
> Given a confusion matrix (trained in scikit-learn):
> [[186 187]
>  [119 997]]
>
> I calculate these variables:
> exp_class0 = conf_matrix[0].sum()
> exp_class1 = conf_matrix[1].sum()
> pred_class0 = conf_matrix[:,0].sum()
> pred_class1 = conf_matrix[:,1].sum()
>
>
> Based on these parameters/constraints, I would like to generate a
> "kind-of-random" confusion matrix showing the same sum of rows and colums
> as the trained confusion matrix, e.g.
> [[184 189]
>  [121 995]]
> which is rather close to my original confusion matrix, but for this
> sampling I didn't need good coding skills. :)
>
> How can such a sampling be done in Python/Numpy?
> I have spent some time on stackoverflow.com et al., but I didn't find a
> proper solution..

for the general n by k case there should be a literature on creating
contingency tables with fixed margins (for exact tests for contingency
tables).
for the 2 by 2 case it looks to me you can just random sample x[0,0]
and then calculate the other three elements.

I calculated once what the table is that is most concentrated on the diagonal.
I'm also interested, since I never had the time to code this.

Josef

>
> Cheers & Thanks,
> Paul
>
>
> This message and any attachment are confidential and may be privileged or 
> otherwise protected from disclosure. If you are not the intended recipient, 
> you must not copy this message or attachment or disclose the contents to any 
> other person. If you have received this transmission in error, please notify 
> the sender immediately and delete the message and any attachment from your 
> system. Merck KGaA, Darmstadt, Germany and any of its subsidiaries do not 
> accept liability for any omissions or errors in this message which may arise 
> as a result of E-Mail-transmission or for damages resulting from any 
> unauthorized changes of the content of this message and any attachment 
> thereto. Merck KGaA, Darmstadt, Germany and any of its subsidiaries do not 
> guarantee that this message is free of viruses and does not accept liability 
> for any damages caused by any virus transmitted therewith.
>
> Click http://www.merckgroup.com/disclaimer to access the German, French, 
> Spanish and Portuguese versions of this disclaimer.
>
> ------------------------------------------------------------------------------
> Everyone hates slow websites. So do we.
> Make your web apps faster with AppDynamics
> Download AppDynamics Lite for free today:
> http://p.sf.net/sfu/appdyn_d2d_mar
> _______________________________________________
> Scikit-learn-general mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/scikit-learn-general

------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_mar
_______________________________________________
Scikit-learn-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/scikit-learn-general

Reply via email to