当前位置: 首页>>代码示例>>Python>>正文


Python Classifier.__init__方法代码示例

本文整理汇总了Python中classifier.Classifier.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python Classifier.__init__方法的具体用法?Python Classifier.__init__怎么用?Python Classifier.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在classifier.Classifier的用法示例。


在下文中一共展示了Classifier.__init__方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from classifier import Classifier [as 别名]
# 或者: from classifier.Classifier import __init__ [as 别名]
  def __init__(self, D, H, W, K, iternum):
    Classifier.__init__(self, D, H, W, K, iternum)
    self.L = 100 # size of hidden layer

    """ Layer 1 Parameters """
    # weight matrix: [M * L]
    self.A1 = 0.01 * np.random.randn(self.M, self.L)
    # bias: [1 * L]
    self.b1 = np.zeros((1,self.L))

    """ Layer 3 Parameters """
    # weight matrix: [L * K]
    self.A3 = 0.01 * np.random.randn(self.L, K)
    # bias: [1 * K]
    self.b3 = np.zeros((1,K))

    """ Hyperparams """
    # learning rate
    self.rho = 1e-2
    # momentum
    self.mu = 0.9
    # reg strencth
    self.lam = 0.1
    # velocity for A1: [M * L]
    self.v1 = np.zeros((self.M, self.L))
    # velocity for A3: [L * K] 
    self.v3 = np.zeros((self.L, K))
    return
开发者ID:dyx0718,项目名称:Spark,代码行数:30,代码来源:nn.py

示例2: __init__

# 需要导入模块: from classifier import Classifier [as 别名]
# 或者: from classifier.Classifier import __init__ [as 别名]
    def __init__(self, fname, *args, **kargs):
        Classifier.__init__(self, fname, *args, **kargs)

        # sometimes a threshold value is trained during Bayesian
        # classification to avoid classifying too many 'documents' as
        # one kind or the other
        self.thresholds = [1.0, 1.0]
开发者ID:Web5design,项目名称:sentimentstwitter,代码行数:9,代码来源:naivebayesclassifier.py

示例3: __init__

# 需要导入模块: from classifier import Classifier [as 别名]
# 或者: from classifier.Classifier import __init__ [as 别名]
  def __init__(self, D, H, W, K, iternum):
    Classifier.__init__(self, D, H, W, K, iternum)
    """ Parameters """
    # weight matrix: [M * K]
    self.A = 0.01 * np.random.randn(self.M, K)
    # bias: [1 * K]
    self.b = np.zeros((1,K))

    """ Hyperparams """
    # learning rate
    self.rho = 1e-5
    # momentum
    self.mu = 0.9
    # reg strength
    self.lam = 1e1
    # velocity for A: [M * K]
    self.v = np.zeros((self.M, K))
    return
开发者ID:tehalexf,项目名称:proj4_starter,代码行数:20,代码来源:linear.py

示例4: __init__

# 需要导入模块: from classifier import Classifier [as 别名]
# 或者: from classifier.Classifier import __init__ [as 别名]
    def __init__(self, rawfname, min_occurences=5, **kargs):
        Classifier.__init__(self, rawfname, **kargs)

        self.min_occurences = min_occurences

        # Maintains all training examples
        self.all_training_examples = []

        # Each example contains only keys for features which occurred more
        # than <min_occurences> times in the training set
        self.shrunk_training_examples = []

        # { feature -> num times <feature> was seen }
        self.all_features = {}
        self.model = None

        self.filesubset = kargs.get('filesubset', 3000)

        self.max_iter = kargs.get('max_iter', 4)
开发者ID:shubh29,项目名称:TwitterSentimentAnalysis,代码行数:21,代码来源:maxentclassifier.py

示例5: __init__

# 需要导入模块: from classifier import Classifier [as 别名]
# 或者: from classifier.Classifier import __init__ [as 别名]
  def __init__(self, D, H, W, K, iternum):
    Classifier.__init__(self, D, H, W, K, iternum)

    """ 
    Layer 1 Parameters (Conv 32 x 32 x 16) 
    K = 16, F = 5, S = 1, P = 2
    weight matrix: [K1 * D * F1 * F1]
    bias: [K1 * 1]
    """
    K1, F1, self.S1, self.P1 = 16, 5, 1, 2
    self.A1 = 0.01 * np.random.randn(K1, D, F1, F1)
    self.b1 = np.zeros((K1, 1))
    H1 = (H - F1 + 2*self.P1) / self.S1 + 1
    W1 = (W - F1 + 2*self.P1) / self.S1 + 1

    """ 
    Layer 3 Parameters (Pool 16 x 16 x 16) 
    K = 16, F = 2, S = 2
    """
    K3, self.F3, self.S3 = K1, 2, 2
    H3 = (H1 - self.F3) / self.S3 + 1
    W3 = (W1 - self.F3) / self.S3 + 1
 
    """ 
    Layer 4 Parameters (Conv 16 x 16 x 20) 
    K = 20, F = 5, S = 1, P = 2
    weight matrix: [K4 * K3 * F4 * F4]
    bias: [K4 * 1]
    """
    K4, F4, self.S4, self.P4 = 20, 5, 1, 2
    self.A4 = 0.01 * np.random.randn(K4, K3, F4, F4)
    self.b4 = np.zeros((K4, 1))
    H4 = (H3 - F4 + 2*self.P4) / self.S4 + 1
    W4 = (W3 - F4 + 2*self.P4) / self.S4 + 1

    """ 
    Layer 6 Parameters (Pool 8 x 8 x 20) 
    K = 20, F = 2, S = 2
    """
    K6, self.F6, self.S6 = K4, 2, 2
    H6 = (H4 - self.F6) / self.S6 + 1
    W6 = (W4 - self.F6) / self.S6 + 1

    """ 
    Layer 7 Parameters (Conv 8 x 8 x 20) 
    K = 20, F = 5, S = 1, P = 2
    weight matrix: [K7 * K6 * F7 * F7]
    bias: [K7 * 1]
    """
    K7, F7, self.S7, self.P7 = 20, 5, 1, 2
    self.A7 = 0.01 * np.random.randn(K7, K6, F7, F7)
    self.b7 = np.zeros((K7, 1))
    H7 = (H6 - F7 + 2*self.P7) / self.S7 + 1
    W7 = (W6 - F7 + 2*self.P7) / self.S7 + 1

    """ 
    Layer 9 Parameters (Pool 4 x 4 x 20) 
    K = 20, F = 2, S = 2
    """
    K9, self.F9, self.S9 = K7, 2, 2
    H9 = (H7 - self.F9) / self.S9 + 1
    W9 = (W7 - self.F9) / self.S9 + 1

    """ 
    Layer 10 Parameters (FC 1 x 1 x K)
    weight matrix: [(K6 * H_6 * W_6) * K] 
    bias: [1 * K]
    """
    self.A10 = 0.01 * np.random.randn(K9 * H9 * W9, K)
    self.b10 = np.zeros((1, K))

    """ Hyperparams """
    # learning rate
    self.rho = 1e-2
    # momentum
    self.mu = 0.9
    # reg strength
    self.lam = 0.1
    # velocity for A1: [K1 * D * F1 * F1]
    self.v1 = np.zeros((K1, D, F1, F1))
    # velocity for A4: [K4 * K3 * F4 * F4]
    self.v4 = np.zeros((K4, K3, F4, F4))
    # velocity for A7: [K7 * K6 * F7 * F7]
    self.v7 = np.zeros((K7, K6, F7, F7))
    # velocity for A10: [(K9 * H9 * W9) * K]   
    self.v10 = np.zeros((K9 * H9 * W9, K))
 
    return
开发者ID:LeicongLi,项目名称:SparkDeepLearning,代码行数:90,代码来源:cnn.py

示例6: __init__

# 需要导入模块: from classifier import Classifier [as 别名]
# 或者: from classifier.Classifier import __init__ [as 别名]
	def __init__(self, root_dir, input_text, config_dirs):
		Classifier.__init__(self, input_text)

		self.master_word_list = []
		self.word_features = []
		self.configs = utils.load_json_file(config_dirs)
开发者ID:roulaoregan,项目名称:oracle,代码行数:8,代码来源:naivebayes.py

示例7: __init__

# 需要导入模块: from classifier import Classifier [as 别名]
# 或者: from classifier.Classifier import __init__ [as 别名]
 def __init__(self, feature):
     Classifier.__init__(self, feature)
     self.threshold = None
开发者ID:amjoker,项目名称:adaboost,代码行数:5,代码来源:linear.py


注:本文中的classifier.Classifier.__init__方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。