0
$\begingroup$

The problem

I tried to do some ML models but everytime I had some weird plots and I couldn't understand these scores. I'm relatively new to ML and maybe someone can help me with this data with some example (DecisionTreeClassifier/SVM/RandomForestClassifier/KNN) how to deal with it and interpret.

The dataset

I have two datasets:

  1. "seq.csv" with frequency of every aminoacid in specific protein:
A,C,D,E,F,G,H,I,K,L,M,N,P,Q,R,S,T,V,W,Y
17,0,6,14,5,11,12,9,19,18,3,2,4,5,4,6,5,9,2,3
17,0,10,8,5,11,1,10,13,16,5,12,3,5,13,6,12,9,3,6
18,0,6,14,6,11,11,9,19,18,3,2,4,5,4,6,5,8,2,3
16,0,11,8,5,11,1,10,13,17,5,12,3,5,13,7,12,9,3,6
  1. "secstr.csv" with frequency of every bond of secondary structure in specific protein:
H,G,I,B,E,S,T,C, 
108,12,0,0,0,3,12,0,19
102,3,0,1,14,12,15,0,18
109,9,0,0,0,2,14,0,20
103,3,0,1,12,9,13,0,26

Code example

import numpy as np
from sklearn.model_selection import train_test_split

X = np.asarray(seq_df)
Y = np.asarray(sec_str_df['H'])

X_train, X_test, y_train, y_test = train_test_split(X, Y, test_size=0.33, shuffle= True)
X_train.shape, X_test.shape
>>>((67, 20), (33, 20))

##########################

from sklearn.linear_model import LinearRegression

lineReg = LinearRegression()
lineReg.fit(X_train, y_train)
print('Score: ', lineReg.score(X_test, y_test))
print('Weights: ', lineReg.coef_)

plt.plot(lineReg.predict(X_test))
plt.plot(y_test)
plt.show()
>>>Score:  0.6800436491044164
Weights:  [-0.87378736 -0.13286578 -4.03961593  2.71956276 -1.6088727  -1.655681
 -3.381233    1.89215565  1.47324114  5.08374842  1.97302355 -2.77426402
 -0.92489368 -1.24430955  3.09726346 -0.41345148  0.11391256 -1.95393996
 -0.71682087  0.05350237]

##########################

clf = DecisionTreeClassifier(max_depth = 4, 
                             random_state = 0)
clf.fit(X_train, y_train)
>>>DecisionTreeClassifier(ccp_alpha=0.0, class_weight=None, criterion='gini',
                       max_depth=4, max_features=None, max_leaf_nodes=None,
                       min_impurity_decrease=0.0, min_impurity_split=None,
                       min_samples_leaf=1, min_samples_split=2,
                       min_weight_fraction_leaf=0.0, presort='deprecated',
                       random_state=0, splitter='best')

The goal

I'm trying to predict likelihood of occurence specific bond in protein based on aminoacid frequency.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.