Package: shinnosuke
Shinnosuke : Deep learning frameworkDescriptionsBased on Numpy(CPU version)Completely realized by Python onlyKeras-like APIGraph are used to construct the systemFor deep learning studyingFeaturesNative to PythonKeras-like APIEasy to get startCommonly used models are provided: Dense, Conv2D, MaxPooling2D, LSTM, SimpleRNN, etcSeveral basic networks ExamplesSequential model and Functional model are implementedAutograd is supportedtraining is conducted on forward graph and backward graphInstallationRequirements(recommend)Numpy=1.15.0matplotlib=3.0.3Using pip:$ pip install shinnosukeExamplesShinnosuke provides several classcic AI tasks:mnist handwrite number recognitionDense(FullyConnected neural network)fromshinnosuke.modelsimportSequentialfromshinnosuke.layers.FCimportDensem=Sequential()m.add(Dense(500,activation='relu',n_in=784))#must be specify n_in if first layerm.add(Dense(10,activation='softmax'))#no need to specify n_in as shinnosuke will automatic calculate the input and output dimm.compile(optimizer='sgd',loss='sparse_categorical_crossentropy')#specify optimizer and objective,if your want to apply softmax for multi-classify tasks and your labels are one-hot vectors/matrixm,use sparse_categorical_crossentropy(recommend),otherwise use categorical_crossentropy.model.fit(trainX,trainy,batch_size=512,epochs=5,validation_ratio=0.)CNN(Convolutional neural network)X_input=Input(shape=(None,1,28,28))#represents batch_size,channels,height and width respectively,notice that channels must be at the axis 1 instead of -1X=Conv2D(8,(3,3),padding='VALID',initializer='normal',activation='relu')(X_input)X=MaxPooling2D((2,2))(X)X=Flatten()(X)X=Dense(10,initializer='normal',activation='softmax')(X)model=Model(inputs=X_input,outputs=X)model.compile(optimizer='sgd',loss='sparse_categorical_cross_entropy')model.fit(trainX,trainy,batch_size=256,epochs=80,validation_ratio=0.)SupportsTwo model types:1.Sequentialfromshinnosuke.modelsimportSequentialfromshinnosuke.layers.FCimportDensem=Sequential()m.add(Dense(500,activation='relu',n_in=784))m.add(Dense(10,activation='softmax'))m.compile(optimizer='sgd',loss='sparse_categorical_crossentropy',learning_rate=0.1)m.fit(trainX,trainy,batch_size=512,epochs=1,validation_ratio=0.)2.Modelfromshinnosuke.modelsimportModelfromshinnosuke.layers.FCimportDensefromshinnosuke.layers.BaseimportInputX_input=Input(shape=(None,784))X=Dense(500,activation='relu')(X_input)X=Dense(10,activation='softmax')(X)model=Model(inputs=X_input,outputs=X)model.compile(optimizer='sgd',loss='sparse_categorical_crossentropy',learning_rate=0.1)model.fit(trainX,trainy,batch_size=512,epochs=1,validation_ratio=0.)Two basic class:- Layer:DenseConv2DMaxPooling2DMeanPooling2DActivationInputDropoutBatchNormalizationTimeDistributedSimpleRNNLSTMGRU (waiting for implemented)ZeroPadding2DOperations( includes Add, Minus, Multiply, Matmul, and so on basic operations for Layer and Node)Layer Operations are conducted to construt the graph.
for examples:- Node:VariableConstantWhile Node Operations have both dynamic graph and static graph featuresx=Variable(3)y=Variable(5)z=x+yprint(z.get_value())#you suppose get a value 8,at same time shinnosuke construct a graph as below(waiting to implement):OptimizersStochasticGradientDescentMomentumRMSpropAdaGradAdaDeltaAdamWaiting for implemented moreObjectivesMeanSquaredErrorMeanAbsoluteErrorBinaryCrossEntropySparseCategoricalCrossEntropyCategoricalCrossEntropyActivationsReluLinearSigmoidTanhSoftmaxInitializationsZerosOnesUniformLecunUniformGlorotUniformHeUniformNormalLecunNormalGlorotNormalHeNormalOrthogonalRegularizeswaiting for implement.Utilsget_batches (generate mini-batch)to_categorical (convert inputs to one-hot vector/matrix)concatenate (concatenate Nodes that have the same shape in specify axis)pad_sequences (pad sequences to the same length)