c++ - Value error in Python f\x00o\x00r\x00t -
i embedding python c++. sending big amount of data c++ python , doing manipulations on data in python. in c++ data stored in form of 2-d vector of float via tuple sending python.
now, not sure in format data received in python. in str or utf-16 or utf-8(i dont know meanings of these things). aim receive data array on here in python , apply scikit-learn functions it.
i able apply numpy.array functions , convert data received in python numpy arrays. now, when passing array scikit functions giving me error u"invalid mode, expected 'c' or 'fortran', got f\x00o\x00r\x00t" .
by looking @ different posts, pretty sure has way data read in python i.e format solution provided everywhere dealing reading files , whenever open file use utf-16 in scenario dont have file have arguments in python. how read them in proper format pass them scikit functions?
call c++ : pvalue = pyobject_callobject(pfunc, pargtuple); python side : import numpy np import scipy.io sklearn import cross_validation sklearn.neighbors import kneighborsclassifier sklearn.metrics import accuracy_score fs_package.function.similarity_based import fisher_score fs_package.utility import construct_w def main(*z): alist = [] print "i called with", len(z), "arguments:" in range(len(z) - 1): alist.append(z[i]) x1 = np.array(alist) x = x1.t y = np.array(z[len(z) - 1]) n_samples, n_features = x.shape num_fea = 100 neigh = kneighborsclassifier(n_neighbors=10) train, test in ss: selected_features = x[:, idx[0:num_fea]] neigh.fit(selected_features[train], y[train])
the neigh.fit giving me error.
Comments
Post a Comment