Advertisement

CS231n Assignment 1: Linear Classifier and Softmax

阅读量:

cs231n/classifiers/linear_classifier.py代码文件中包含了与线性分类器相关的实现内容。

复制代码
    from __future__ import print_function
    
    import numpy as np
    from cs231n.classifiers.linear_svm import *
    from cs231n.classifiers.softmax import *
    
    class LinearClassifier(object):
    
      def __init__(self):
    self.W = None
    
      def train(self, X, y, learning_rate=1e-3, reg=1e-5, num_iters=100,
            batch_size=200, verbose=False):
    """
    Train this linear classifier using stochastic gradient descent.
    
    Inputs:
    - X: A numpy array of shape (N, D) containing training data; 

全部评论 (0)

还没有任何评论哟~