I have just started using scikit and I have been following the example code
at
http://scikit-learn.org/stable/auto_examples/neighbors/plot_classification.html


I am having some trouble with my data, here is the code that I have been
using to import my data from csv files that I dump out of a database.


query_csv_file = 'query_result.csv'

X = np.loadtxt(fname = query_csv_file, delimiter = ',', skiprows = 1)

id_csv_file = 'query_id.csv'

y = np.loadtxt(fname = id_csv_file, delimiter = ‘,', skiprows = 1)


query_result.csv looks like the following:

attr1,attr2,attr3,attr4,attr5,attr6,attr7,attr8,attr9,attr10,attr11,attr12,attr13,attr14,attr15,attr16,attr17,attr18

0,797.3700774,0,330.8733288,155.4552568,0,6177.289831,0,355.3611942,82.92122107,0,49.93354722,1592.292597,435.3831843,721.4373622,73.07706747,194.5707382,0


query_id.csv looks like the following:

id

1


If I try to run the code in the example using this data I get the following
error:

ValueError: Incompatible dimension for X and Y matrices: X.shape[1] == 2
while Y.shape[1] == 18


If I add the following line of code it works but then it is not using all
18 attributes:

X = X[:, :2]


Any help or guidance would be appreciated! Thanks in advance!
------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=157005751&iu=/4140/ostg.clktrk
_______________________________________________
Scikit-learn-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/scikit-learn-general

Reply via email to