Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

svm_cv.py won't work with tanimoto kernel #7

Open
LanceKnight opened this issue Feb 17, 2021 · 0 comments
Open

svm_cv.py won't work with tanimoto kernel #7

LanceKnight opened this issue Feb 17, 2021 · 0 comments

Comments

@LanceKnight
Copy link

Dear professor,

This is just a reference for me in the future and also for people who encounter the same problem as I did.

It seems like the codes won't work with Tanimoto kernel. It was caused by the list type nature of input data. Adding a conditional statement to convert inputs from list to ndarray for both the training and testing should work:

For training:

		if kwargs['kernel'] not in ['tanimoto']:
			model.fit([x[0] for x in data[0]['mols']], data[0]['y'])
		else:
			train_x = np.array([x[0] for x in data[0]['mols']])
			train_y = np.array(data[0]['y'])

For testing:

	if kwargs['kernel'] not in ['tanimoto']:		
		predicted_y = model.predict(test_x)
	else:
		test_x = np.array(test_x)
		predicted_y = model.predict(test_x)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant