0
$\begingroup$

I have trained an SVM/Logistic regression machine learning model using its scikit implementation.

But now I want to do the same with Tensorflow/Keras. This is for easy conversion to Tensorflow.js. Here is the code I am using::


    classifiers=[


    (SVC(C=50.0, cache_size=200, class_weight=None, coef0=0.0,
    decision_function_shape='ovr', degree=3, gamma='auto', kernel='rbf',
    max_iter=-1, probability=False, random_state=None, shrinking=True,
    tol=0.001, verbose=False),'Support Vector Machine Classifier'),

    (LogisticRegression(penalty='l1', dual=False, tol=0.0001, C=100.0, fit_intercept=True,
    intercept_scaling=10, class_weight=None, random_state=None, solver='warn', max_iter=10,
    multi_class='warn', verbose=0, warm_start=False, n_jobs=None),"Logistic Regression")

]


for model,name in classifiers:
    clf=model.fit(x_train,y_train)
    y_pred=clf.predict(x_val)
    predicted = np.array([int_to_label[i] for i in y_pred])

How can I implement the same in Tensorflow/Keras? Any one implementation, SVM or Logistic regression will also suffice.

$\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.