How to use the modelbase.ModelBase function in modelbase

To help you get started, we’ve selected a few modelbase examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github uoguelph-mlrg / Theano-MPI / lib / models / googlenet.py View on Github external
softmax_layer = Softmax(input=drp.output ,n_in=1024, n_out=config['n_softmax_out'])
        
        layers.append(softmax_layer)
        params += softmax_layer.params
        weight_types += softmax_layer.weight_type
        
        self.layers = layers
        self.params = params
        self.weight_types = weight_types
        self.output = softmax_layer.p_y_given_x
        self.negative_log_likelihood = softmax_layer.negative_log_likelihood
         
              
    

class GoogLeNet(ModelBase):

    """    GoogleNet classifier for ILSVRC.
    
    Parameters:
    
        config:  dict
        training related and model related hyperparameter dict 
    
    References:
    
        [1] C Szegedy, W Liu, Y Jia, P Sermanet, S Reed, 
            D Anguelov, D Erhan, V Vanhoucke, A Rabinovich (2014):
            Going deeper with convolutions.
            The IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2015, pp. 1-9
            
        [2] https://github.com/BVLC/caffe/tree/master/models/bvlc_googlenet
github CalvinNeo / EasyMLPlatform / py / ml_models / logistic.py View on Github external
#coding:utf8
import sys
sys.path.append('..')

from modelbase import ModelBase
import math
import datasets
from datasets.localdata import *
from datasets.monads import *
import operator
import numpy as np
from collections import defaultdict, namedtuple
import itertools
import pickle

class LogisticRegression(ModelBase):
    '''
        simple Logistic Regression is linear
    '''
    def __init__(self, dataset, classfeatureindex = -1, alpha = 0.2, maxiter = 50, *args, **kwargs):
        ModelBase.__init__(self, dataset, 'LOGISTIC', *args, **kwargs)
        self.classfeatureindex = classfeatureindex #index of the column which defines the feature in dataset
        self.Test = self.Classify2
        self.Apply = self.ClassifyDataset
        self.Train = self.Regress
        self.Save = self.DumpLogistic
        self.Load = self.LoadLogistic
        self.Graph = self.ShowImage
        self.Positive = 1
        self.Negative = -1
        # use default
        # self.T = self.RealValue
github uoguelph-mlrg / Theano-MPI / lib / models / lasagne_model_zoo / vgg.py View on Github external
for layer in net.values():
            print str(lasagne.layers.get_output_shape(layer))
        
    return net
    

import numpy as np
import theano
import theano.tensor as T
rng = np.random.RandomState(23455)

import sys
sys.path.append('../lib/base/models/')
from modelbase import ModelBase 

class VGG(ModelBase): # c01b input

    '''

    overwrite those methods in the ModelBase class


    '''
    
    def __init__(self,config): 
        ModelBase.__init__(self)
        
        self.config = config
        self.verbose = config['verbose']
        
        self.name = 'vggnet'
github uoguelph-mlrg / Theano-MPI / lib / models / vggnet_16.py View on Github external
import theano
import theano.tensor as T
import numpy as np
from layers2 import Conv,Pool,Dropout,FC,Softmax,Flatten,LRN, \
                    HeUniform, HeNormal, Constant, Normal, \
                    get_params, get_layers
from modelbase import ModelBase

# other tools minerva, chainer


class VGGNet_16(ModelBase): # c01b input
    
    def __init__(self,config): 
        ModelBase.__init__(self)  

        self.config = config
        self.verbose = self.config['verbose']
        self.build_model()
        # count params
        if self.verbose: self.count_params()
        
    def build_model(self):
        
        if self.verbose: print 'VGGNet_16 3/20'
        
        self.name = 'vggnet'