targets is the class label for the samples. Since you have 178 samples, 
targets' shape should be 178*1.

On May 21, 2013, at 3:40 PM, Paulo Nuin <[email protected]> wrote:

> Hi Lars
> 
> Thanks a lot for the help so far.
> 
> It seems that your method solves part of my troubles. In my case X contains 
> all lines that are not NegCtrl and y the NegCtrl. Currently I am just trying 
> to load the sets into bumpy arrays and run something from the initial 
> tutorial on scikit-learn just to see if it works:
> 
> clf =svm.SVC(gamma=0.001, C=100.)
> clf.fit(data[:-1], target[:-1])
> 
> When I run my scripts I get the data and target shapes as:
> 
> (179, 205)
> (53, 205)
> 
> but I still get an error at the end when trying to fit the data
> 
> Traceback (most recent call last):
>  File "read.py", line 46, in <module>
>    clf.fit(data[:-1], target[:-1])
>  File "/Library/Python/2.7/site-packages/sklearn/svm/base.py", line 166, in 
> fit
>    (X.shape[0], y.shape[0]))
> ValueError: X and y have incompatible shapes.
> X has 178 samples, but y has 10660.
> 
> Any further help is appreciated.
> 
> Thanks
> 
> Paulo
> 
> 
> 
> 
> On 2013-05-18, at 8:02 AM, Lars Buitinck <[email protected]> wrote:
> 
>> 2013/5/18 Paulo Nuin <[email protected]>:
>>> Drp1    41      1.91457014241   0.251069883932  103.0949514     
>>> 0.147634342712  1.75424087726   0.391473420716  0.
>> 
>> If you get rid of the extra 0. at the end of this line, which I'm
>> assuming is a mistake, then you can use np.genfromtxt [1] to easily
>> load this file.
>> 
>> with open("inputfile.txt") as infile:
>>   data = np.genfromtxt((ln for ln in infile if not
>> ln.startswith("NegCtrl")), skip_header=1)
>>   data = data[:, 2:]
>> 
>>> But when I do this I get a ValueError that X and y have incompatible shapes.
>> 
>> What in this table is X, what is y, and what are you trying to do?
>> 
>> [1] http://bit.ly/109oTHs
>> 
>> -- 
>> Lars Buitinck
>> Scientific programmer, ILPS
>> University of Amsterdam
>> 
>> ------------------------------------------------------------------------------
>> AlienVault Unified Security Management (USM) platform delivers complete
>> security visibility with the essential security capabilities. Easily and
>> efficiently configure, manage, and operate all of your security controls
>> from a single console and one unified framework. Download a free trial.
>> http://p.sf.net/sfu/alienvault_d2d
>> _______________________________________________
>> Scikit-learn-general mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/scikit-learn-general
> 
> 
> ------------------------------------------------------------------------------
> Try New Relic Now & We'll Send You this Cool Shirt
> New Relic is the only SaaS-based application performance monitoring service 
> that delivers powerful full stack analytics. Optimize and monitor your
> browser, app, & servers with just a few lines of code. Try New Relic
> and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_may
> _______________________________________________
> Scikit-learn-general mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/scikit-learn-general


------------------------------------------------------------------------------
Get 100% visibility into Java/.NET code with AppDynamics Lite
It's a free troubleshooting tool designed for production
Get down to code-level detail for bottlenecks, with <2% overhead.
Download for free and get started troubleshooting in minutes.
http://p.sf.net/sfu/appdyn_d2d_ap2
_______________________________________________
Scikit-learn-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/scikit-learn-general

Reply via email to