I'm solving a task in coursera and get stuck with sorting in sparse matrix.
The problem is: i make a support vector classification (sklearn.svm.SVC
)
clf = SVC(C=1, kernel='linear', random_state=241)
clf.fit(X, y)
and as a result got a matrix clf.coef_
of [index_id; weight]
.
Now i need to extract top N weight and their indices, but weights
sorting with clf.coef_.argsort()
does not lead to simultaneous index_id
sorting.
How can i sort this matrix not breaking [index_id; weight]
link?