精华内容
下载资源
问答
  • DigitRecognizer

    2019-06-25 20:40:07
    import pandas as pd import numpy as np import matplotlib.pyplot as plt import matplotlib.image as mpimg import seaborn as sns import itertools from sklearn.model_selection import train_test_split ...
    import pandas as pd
    import numpy as np
    import matplotlib.pyplot as plt
    import matplotlib.image as mpimg
    import seaborn as sns
    import itertools
    from sklearn.model_selection import train_test_split
    from sklearn.metrics import confusion_matrix
    
    from keras.utils.np_utils import to_categorical # convert to one-hot-encoding
    from keras.models import Sequential
    from keras.models import load_model
    from keras.layers import Dense, Dropout, Flatten, Conv2D, MaxPool2D
    from keras.optimizers import RMSprop
    from keras.preprocessing.image import ImageDataGenerator
    from keras.callbacks import ReduceLROnPlateau
    
    np.random.seed(2)
    
    # Load the data
    train = pd.read_csv("./input/train.csv")
    test = pd.read_csv("./input/test.csv")
    
    Y_train = train["label"]
    # Drop 'label' column
    X_train = train.drop(labels = ["label"],axis = 1)
    
    # free some space
    del train
    #Reshape
    # Normalize the data
    X_train = X_train / 255.0
    test = test / 255.0
    
    X_train = np.array(X_train.values.reshape(-1,28,28,1))
    test = np.array(test.values.reshape(-1,28,28,1))
    
    def analysis_data():
        # g=sns.countplot(Y_train)
        # Y_train.value_counts()
        # plt.show()
        # #Check for null and missing values
        # X_train.isnull().any().describe()
        # test.isnull().any().describe()
        print(X_train[0].shape)
        g=plt.imshow(X_train[0][:,:,0])
        plt.show()
    
    
    #analysis_data()
    
    
    
    #Label encoding
    Y_train = to_categorical(Y_train, num_classes = 10)
    
    # Set the random seed
    random_seed = 2
    
    # Split the train and the validation set for the fitting
    X_train, X_val, Y_train, Y_val = train_test_split(X_train, Y_train, test_size = 0.1, random_state=random_seed)
    
    
    
    model_name='cnn_model.h5'
    def train():
        # Define the model
        model = Sequential()
        model.add(Conv2D(filters=32, kernel_size=(5, 5), padding='Same',
                         activation='relu', input_shape=(28, 28, 1)))
        model.add(Conv2D(filters=32, kernel_size=(5, 5), padding='Same',
                         activation='relu'))
        model.add(MaxPool2D(pool_size=(2, 2)))
        model.add(Dropout(0.25))
    
        model.add(Conv2D(filters=64, kernel_size=(3, 3), padding='Same',
                         activation='relu'))
        model.add(Conv2D(filters=64, kernel_size=(3, 3), padding='Same',
                         activation='relu'))
        model.add(MaxPool2D(pool_size=(2, 2), strides=(2, 2)))
        model.add(Dropout(0.25))
    
        model.add(Flatten())
        model.add(Dense(256, activation="relu"))
        model.add(Dropout(0.5))
        model.add(Dense(10, activation="softmax"))
    
        # Define the optimizer
        optimizer = RMSprop(lr=0.001, rho=0.9, epsilon=1e-08, decay=0.0)
    
        # Compile the model
        model.compile(optimizer=optimizer, loss="categorical_crossentropy", metrics=["accuracy"])
    
        # Set a learning rate annealer
        learning_rate_reduction = ReduceLROnPlateau(monitor='val_acc',
                                                    patience=3,
                                                    verbose=1,
                                                    factor=0.5,
                                                    min_lr=0.00001)
    
        epochs = 2  # Turn epochs to 30 to get 0.9967 accuracy
        batch_size = 86
    
        # Data augmentation
        datagen = ImageDataGenerator(
            featurewise_center=False,  # set input mean to 0 over the dataset
            samplewise_center=False,  # set each sample mean to 0
            featurewise_std_normalization=False,  # divide inputs by std of the dataset
            samplewise_std_normalization=False,  # divide each input by its std
            zca_whitening=False,  # apply ZCA whitening
            rotation_range=10,  # randomly rotate images in the range (degrees, 0 to 180)
            zoom_range=0.1,  # Randomly zoom image
            width_shift_range=0.1,  # randomly shift images horizontally (fraction of total width)
            height_shift_range=0.1,  # randomly shift images vertically (fraction of total height)
            horizontal_flip=False,  # randomly flip images
            vertical_flip=False)  # randomly flip images
    
        datagen.fit(X_train)
    
        # Fit the model
        history = model.fit_generator(datagen.flow(X_train,Y_train, batch_size=batch_size),
                                      epochs = epochs, validation_data = (X_val,Y_val),
                                      verbose = 2, steps_per_epoch=X_train.shape[0] // batch_size
                                      , callbacks=[learning_rate_reduction])
    
        model.save(model_name)
    
        # Plot the loss and accuracy curves for training and validation
        fig, ax = plt.subplots(2,1)
        ax[0].plot(history.history['loss'], color='b', label="Training loss")
        ax[0].plot(history.history['val_loss'], color='r', label="validation loss",axes =ax[0])
        legend = ax[0].legend(loc='best', shadow=True)
    
        ax[1].plot(history.history['acc'], color='b', label="Training accuracy")
        ax[1].plot(history.history['val_acc'], color='r',label="Validation accuracy")
        legend = ax[1].legend(loc='best', shadow=True)
        plt.show()
    
    
    def plot_confusion_matrix(cm, classes,
                              normalize=False,
                              title='Confusion matrix',
                              cmap=plt.cm.Blues):
        """
        This function prints and plots the confusion matrix.
        Normalization can be applied by setting `normalize=True`.
        """
        plt.imshow(cm, interpolation='nearest', cmap=cmap)
        plt.title(title)
        plt.colorbar()
        tick_marks = np.arange(len(classes))
        plt.xticks(tick_marks, classes, rotation=45)
        plt.yticks(tick_marks, classes)
    
        if normalize:
            cm = cm.astype('float') / cm.sum(axis=1)[:, np.newaxis]
    
        thresh = cm.max() / 2.
        for i, j in itertools.product(range(cm.shape[0]), range(cm.shape[1])):
            plt.text(j, i, cm[i, j],
                     horizontalalignment="center",
                     color="white" if cm[i, j] > thresh else "black")
    
        plt.tight_layout()
        plt.ylabel('True label')
        plt.xlabel('Predicted label')
        plt.show()
    
    def compute_confusion_matrix():
        model=load_model(model_name)
        # Predict the values from the validation dataset
        Y_pred = model.predict(X_val)
        # Convert predictions classes to one hot vectors
        Y_pred_classes = np.argmax(Y_pred, axis=1)
        # Convert validation observations to one hot vectors
        Y_true = np.argmax(Y_val, axis=1)
        # compute the confusion matrix
        confusion_mtx = confusion_matrix(Y_true, Y_pred_classes)
    
        # plot the confusion matrix
        plot_confusion_matrix(confusion_mtx, classes=range(10))
    
    def display_errors(errors_index,img_errors,pred_errors, obs_errors):
        """ This function shows 6 images with their predicted and real labels"""
        n = 0
        nrows = 2
        ncols = 3
        fig, ax = plt.subplots(nrows,ncols,sharex=True,sharey=True)
        for row in range(nrows):
            for col in range(ncols):
                error = errors_index[n]
                ax[row,col].imshow((img_errors[error]).reshape((28,28)))
                ax[row,col].set_title("Predicted label :{}\nTrue label :{}".format(pred_errors[error],obs_errors[error]))
                n += 1
    
        plt.show()
    
    def display_error_results():
        model=load_model(model_name)
        # Predict the values from the validation dataset
        Y_pred = model.predict(X_val)
        # Convert predictions classes to one hot vectors
        Y_pred_classes = np.argmax(Y_pred, axis=1)
        # Convert validation observations to one hot vectors
        Y_true = np.argmax(Y_val, axis=1)
    
        errors=(Y_pred_classes-Y_true!=0)
        Y_pred_classes_errors = Y_pred_classes[errors]
    
        Y_true_errors = Y_true[errors]
        X_val_errors = X_val[errors]
    
        Y_pred_errors=Y_pred[errors]
        # Probabilities of the wrong predicted numbers
        Y_pred_errors_prob = np.max(Y_pred_errors, axis=1)
    
        # Predicted probabilities of the true values in the error set
        true_prob_errors = np.diagonal(np.take(Y_pred_errors, Y_true_errors, axis=1))
    
        # Difference between the probability of the predicted label and the true label
        delta_pred_true_errors = Y_pred_errors_prob - true_prob_errors
    
        # Sorted list of the delta prob errors
        sorted_dela_errors = np.argsort(delta_pred_true_errors)
    
        # Top 6 errors
        most_important_errors = sorted_dela_errors[-6:]
    
        # Show the top 6 errors
        display_errors(most_important_errors, X_val_errors, Y_pred_classes_errors, Y_true_errors)
    
    
    
    
    def test():
        model=load_model(model_name)
    
        results=model.predict(test)
        results=np.argmax(results,axis=1)
        results=pd.Series(results,name='Label')
        submission=pd.concat([pd.Series(range(1,28001),name='ImageId'),results],axis=1)
        submission.to_csv('result.csv',index=False)
    
    
    
    if __name__=='__main__':
        train()
        #compute_confusion_matrix()
        #display_error_results()
        #test()
    
    
    展开全文
  • digitRecognizer-源码

    2021-03-04 18:58:17
    digitRecognizer
  • 数字识别器 该应用程序旨在解释Tensorflow js,canvas和D3。 MNIST数字识别器应用程序。 这个程序的目的是为了教育和娱乐。... git clone https://github.com/ca-montenegro/DigitRecognizer cd Digit
  • MNIST数字识别器 识别手写数字的基本前馈神经网络使用C99编写,没有外部库
  • 数字识别器 先决条件 Java 8 玛文 码头工人 介绍 此应用程序是在Spark 1.5.0或更高版本上运行的数字识别器。 输入数据集来自 ,代表数字图像的像素。 为了正确预测数字,我使用了。 构建识别器 ...
  • 数字识别器-Kaggle 使用 Scikit-Learn 进行数字识别器 Kaggle 比赛。 文件 train.csv 和 test.csv 必须在工作目录中。 SVM_poly_deg2: 使用 SVM 进行数字识别(poly,degree = 2) Kaggle 准确率:0.97871 ...
  • matlab精度检验代码数字识别器 前馈神经网络解决方案的“数字识别器”。 这是一个三层神经网络。 该脚本具有300个隐藏元素,能够实现94.02%的测试集准确性。 使用400个隐藏元素,测试集准确性为94.27%。...
  • Kaggle---DigitRecognizer(数字识别)

    千次阅读 2018-07-11 15:21:18
    Introduction to CNN Keras - 0.997 (top 10%) 数字识别这是kaggle上入门的一道经典题目,最近准备做计算机视觉,所以也是学习了一下,代码供参考。最后取得了0。997的成绩。首次进入kaggle的Top 10%。...

    Introduction to CNN Keras - 0.997 (top 10%)

    数字识别这是kaggle上入门的一道经典题目,最近准备做计算机视觉,所以也是学习了一下,代码供参考。最后取得了0。997的成绩。首次进入kaggle的Top 10%。

    import pandas as pd
    import numpy as np
    import matplotlib.pyplot as plt
    import matplotlib.image as mpimg
    import seaborn as sns
    
    np.random.seed(2)
    from sklearn.model_selection import train_test_split
    from sklearn.metrics import confusion_matrix
    import itertools
    from keras.utils.np_utils import to_categorical #convert to one-hot-encoding
    from keras.models import Sequential
    from keras.layers import Dense, Dropout, Flatten, Conv2D, MaxPool2D
    from keras.optimizers import RMSprop
    from keras.preprocessing.image import ImageDataGenerator
    from keras.callbacks import ReduceLROnPlateau
    
    # Load the data
    train = pd.read_csv("./data/train.csv")
    test = pd.read_csv("./data/test.csv")
    Y_train = train["label"]
    # Drop 'label' column
    X_train = train.drop(labels = ['label'],axis=1)
    del train
    g = sns.countplot(Y_train)
    Y_train.value_counts()
    # Check the data
    X_train.isnull().any().describe()
    test.isnull().any().describe()
    # Normalize the data
    X_train = X_train / 255.0
    test = test / 255.0
    # Reshape image in 3 dimensions (height = 28px, width = 28px, canal = 1)
    X_train = X_train.values.reshape(-1, 28, 28, 1)
    test = test.values.reshape(-1, 28, 28, 1)
    # Encode labels to one hot vectors (ex: 2 -> [0,0,1,0,0,0,0,0,0,0])
    Y_train = to_categorical(Y_train, num_classes=10)
    # Set the random seed
    random_seed = 2
    # Split the train and the validation set for the fitting
    X_train, X_val, Y_train, Y_val = train_test_split(X_train, Y_train, test_size = 0.1, random_state=random_seed)
    # Some examples
    g = plt.imshow(X_train[0][:,:,0])
    
    
    # Set the CNN model
    # my CNN architecture is In -> [[Conv2D->relu]*2 -> MaxPool2D -> Dropout]*2 -> Flatten -> Dense -> Dropout ->Out
    model = Sequential()
    
    model.add(Conv2D(filters = 32, kernel_size = (5, 5),padding = 'Same',activation = 'relu', input_shape = (28,28,1)))
    model.add(Conv2D(filters = 32, kernel_size = (5, 5),padding = 'Same',activation = 'relu'))
    model.add(MaxPool2D(pool_size=(2,2)))
    model.add(Dropout(0.25))
    
    model.add(Conv2D(filters = 64, kernel_size = (3,3),padding = 'Same',activation='relu'))
    model.add(Conv2D(filters = 64, kernel_size = (3,3),padding = 'Same',activation='relu'))
    model.add(MaxPool2D(pool_size=(2,2),strides=(2,2)))
    model.add(Dropout(0.25))
    
    model.add(Flatten())
    model.add(Dense(256, activation = 'relu'))
    model.add(Dropout(0.5))
    model.add(Dense(10, activation = 'softmax'))
    
    # Define the optimizer
    optimizer = RMSprop(lr=0.001, rho=0.9, epsilon=1e-08, decay=0.0)
    
    # Compile the model
    model.compile(optimizer = optimizer, loss = "categorical_crossentropy", metrics=["accuracy"])
    
    # Set a learning rate annealer
    learning_rate_reduction = ReduceLROnPlateau(monitor='val_acc',
                                               patience=3,
                                               verbose=1,
                                               factor=0.5,
                                               min_lr=0.00001)
    
    epochs = 30 # True epochs to 30 to get 0.9967 accuracy
    batch_size = 86
    
    # With data augmentation to prevent overfitting (accuracy 0.99286)
    datagen = ImageDataGenerator(
            featurewise_center=False, # set input mean to 0 over dataset
            samplewise_center=False, # set each sample mean to 0
            featurewise_std_normalization=False,  # divide inputs by std of the dataset
            samplewise_std_normalization=False,  # divide each input by its std
            zca_whitening=False,  # apply ZCA whitening
            rotation_range=10,  # randomly rotate images in the range (degrees, 0 to 180)
            zoom_range = 0.1, # Randomly zoom image 
            width_shift_range=0.1,  # randomly shift images horizontally (fraction of total width)
            height_shift_range=0.1,  # randomly shift images vertically (fraction of total height)
            horizontal_flip=False,  # randomly flip images
            vertical_flip=False)  # randomly flip images)
    
    datagen.fit(X_train)
    
    # Fit the model
    history = model.fit_generator(datagen.flow(X_train,Y_train, batch_size=batch_size),
                                 epochs = epochs, validation_data = (X_val, Y_val),
                                 verbose = 2, steps_per_epoch=X_train.shape[0] //batch_size
                                 ,callbacks=[learning_rate_reduction])
    
    # Plot the loss and accuracy curves for training and validation
    fig, ax = plt.subplots(2,1)
    ax[0].plot(history.history['loss'], color='b', label = "Training loss")
    ax[0].plot(history.history['val_loss'], color='r', label = "validation loss",axes=ax[0])
    legend = ax[0].legend(loc='best', shadow=True)
    
    ax[1].plot(history.history['acc'], color='b', label = "Training accuracy")
    ax[1].plot(history.history['val_acc'], color='r', label = "Validation accuracy")
    legend = ax[1].legend(loc='best', shadow=True)
    
    # Look at confusion matrix
    def plot_confusion_matrix(cm, classes,
                             normalize=False,
                             title='Confusion matrix',
                             cmap=plt.cm.Blues):
        '''
        This function prints and plots the confusion matrix.
        Normalization can be applied by setting `normalize=True`
        '''
        plt.imshow(cm, interpolation='nearest', cmap=cmap)
        plt.title(title)
        plt.colorbar()
        tick_marks = np.arange(len(classes))
        plt.xticks(tick_marks, classes, rotation=45)
        plt.yticks(tick_marks, classes)
        if normalize:
            cm = cm.astype('float') / cm.sum(axis=1)[:,np.newaxis]
    
        thresh = cm.max() / 2.
        for i, j in itertools.product(range(cm.shape[0]), range(cm.shape[1])):
            plt.text(j, i, cm[i, j],
                    horizontalalignment='center',
                    color='white' if cm[i,j] > thresh else 'black')
            plt.tight_layout()
            plt.ylabel('True label')
            plt.xlabel('Predicted label')
    
    # Predict the value from the validation dataset
    Y_pred = model.predict(X_val)
    # Convert predictions classes to one hot vectors
    Y_pred_classes = np.argmax(Y_pred, axis=1)
    # Convert validation observations to one hot vectors
    Y_true = np.argmax(Y_val, axis=1)
    # compute the confusion matrix
    confusion_mtx = confusion_matrix(Y_true, Y_pred_classes)
    # plot the confusion matrix
    plot_confusion_matrix(confusion_mtx, classes=range(10))
    
    # Display some error results
    
    #Errors are difference between predicted labels and true labels
    errors = (Y_pred_classes - Y_true != 0)
    
    Y_pred_classes_errors = Y_pred_classes[errors]
    Y_pred_errors = Y_pred[errors]
    Y_true_errors = Y_true[errors]
    X_val_errors = X_val[errors]
    
    def display_errors(errors_index, img_errors,pred_errors, obs_errors):
        '''This function shows 6 images with their predicted and real labels'''
        n = 0
        nrows = 2
        ncols = 3
        fig, ax = plt.subplots(nrows,ncols,sharex=True,sharey=True)
        for row in range(nrows):
            for col in range(ncols):
                error = errors_index[n]
                ax[row,col].imshow((img_errors[error]).reshape((28,28)))
                ax[row,col].set_title("Predicted label :{}\nTrue label :{}".format(pred_errors[error],obs_errors[error]))
                n += 1
    
    # Probabilities of the wrong predicted numbers
    Y_pred_errors_prob = np.max(Y_pred_errors,axis = 1)
    
    # Predicted probabilities of the true values in the error set
    true_prob_errors = np.diagonal(np.take(Y_pred_errors, Y_true_errors, axis=1))
    
    # Difference between the probability of the predicted label and the true label
    delta_pred_true_errors = Y_pred_errors_prob - true_prob_errors
    
    # Sorted list of the delta prob errors
    sorted_dela_errors = np.argsort(delta_pred_true_errors)
    
    # Top 6 errors
    most_important_errors = sorted_dela_errors[-6:]
    
    # Show the top 6 errors
    display_errors(most_important_errors, X_val_errors, Y_pred_classes_errors, Y_true_errors)
    
    # Predict results
    results = model.predict(test)
    
    #Select the indix with the maximum probability
    results = np.argmax(results, axis=1)
    results = pd.Series(results, name="Label")
    
    submission = pd.concat([pd.Series(range(1,28001),name = "ImageId"),results],axis = 1)
    submission.to_csv("cnn_mnist_datagen.csv",index=False)
    
    展开全文
  • from model.DigitRecognizer import DigitRecognizer # show_test_img.py用来进行测试图片的读取测试 from model.MNISTTestDataset import MNISTTestDataset 具体的使用方法可以参考项目“Digit ...

    示例代码如下:

    import sys
    sys.path.append('..')
    
    from model.DigitRecognizer import DigitRecognizer
    
    # show_test_img.py用来进行测试图片的读取测试
    from model.MNISTTestDataset import MNISTTestDataset

    具体的使用方法可以参考项目“Digit Recognizer”;

    展开全文
  • 德琳·奥格伦姆-源码

    2021-02-10 20:35:14
    德琳·奥格伦姆 ...1-)数据驱动器2-)ArdındanKaggle'dan mnist数据setini indiriniz 3-)Datasetinizinolduğukla​​sörile DigitRecognizer.ipynbdosyasınınbağlantılarınıyapınızıapınız
  • 使用pandas读写csv文件

    2021-04-12 12:25:10
    F:\PYCHARM\KAGGLE\DIGITRECOGNIZER │ DataProcessing.py │ main.py │ Model.py│ └─data │ LinearClassifier.csv │ sample_submission.csv │ test.csv │ train.csv train.csv test.csv 读取csv ...

    • 项目结构
      F:\PYCHARM\KAGGLE\DIGITRECOGNIZER
      │ DataProcessing.py
      │ main.py
      │ Model.py│
      └─data
      │ LinearClassifier.csv
      │ sample_submission.csv
      │ test.csv
      │ train.csv

    train.csv
    在这里插入图片描述

    test.csv
    在这里插入图片描述

    读取csv

    train = pd.read_csv("data/train.csv")
    

    print(train.shape)
    (3,2)

    print(train)
    x y
    0 1 1
    1 2 4
    2 3 9

    表头信息

    print(train.info())
    

    <class ‘pandas.core.frame.DataFrame’>
    RangeIndex: 3 entries, 0 to 2
    Data columns (total 2 columns):
    # Column Non-Null Count Dtype
    — ------ -------------- -----
    0 x 3 non-null int64
    1 y 3 non-null int64
    dtypes: int64(2)
    memory usage: 176.0 bytes

    print(train.train.describe())
    

    在这里插入图片描述

    转换为数组

    print(train.values)
    

    [[1 1]
    [2 4]
    [3 9]]

    选择某一列

    print(train["y"])
    

    0 1
    1 4
    2 9
    Name: y, dtype: int64

    删除某一列

    train.drop("y",1)
    

    x
    0 1
    1 2
    2 3

    导出csv

    ID和Value是表头

    result = list(range(1, 5))
    submission = pd.DataFrame({"ID": range(1, 5), "Value": result})
    submission.to_csv("data/result1.csv", index=False)
    submission.to_csv("data/result2.csv", index=True)
    

    result1.csv
    在这里插入图片描述

    result = list(range(1, 5))
    submission = pd.DataFrame({"ID": range(1, 5), "Value": result})
    submission.to_csv("data/result2.csv", index=True)
    # 多了第一列的数字
    

    result2.csv
    在这里插入图片描述

    展开全文
  • Kaggle-Digit Recognizer-ML

    2020-07-15 17:05:57
    # 1.导入包 import pandas as pd import numpy as np import time # 2....import warnings warnings.filterwarnings("ignore") ...# C:\Users\hjz\AI\project\02_lianxi\01_DigitRecognizer\0_data\train.csv d
  • 运行“DigitRecognizer.m” 2.选择运行模式一种。 测试模式输入板将打开,轴带有红点。 单击鼠标左键并拖动(不要取消单击)鼠标以绘制数字。 如果您取消单击鼠标,它将不会绘制任何内容。 如果要继续绘制,请再次...
  • class DigitRecognizer: '''此函数指定训练模型是CNN还是KNN''' def __init__(self, modeltype): self.writeimg = True self.modeltype = modeltype #笔者亲测还是使用KNN的效果更优 if modeltype == "CNN": ...
  • bottle创建python的rest接口

    千次阅读 2017-11-15 21:47:37
    file='E:\\python\\kaggle\\DigitRecognizer\\picture\\picture'+ name + '.jpg' pixel_lists = [] print 'file path is:' print file img = Image.open(file) img = img.convert("L") print img img = img....
  • java调用python脚本

    2017-11-15 21:49:56
    String filepath = "E:\\python\\kaggle\\DigitRecognizer\\picture\\picture"; String filename = "1.jpg"; String python = "D:\\ProgramData\\Anaconda2\\python.exe"; String command = "D:\\ProgramFiles\...
  • Kaggle Digit Recognizer别人分享的tricks 自己在利用CNN做了kaggle上的入门题——Digit Recognizer,简单的利用了CNN的网络架构就实现了0.98+的准确率,但还是不够啊,所以看了上面大佬的分享,找到一篇不错的分享,...
  • Kaggle手写数字识别 -- CNN

    千次阅读 2019-03-17 22:22:43
    data = pd.read_csv('C:/Users/FrankFang/Desktop/Kaggle/DigitRecognizer/train.csv') print('data({0[0]},{0[1]})'.format(data.shape))#(42000,785),自动去掉了第一行的说明 print (data.head())#默认输出矩阵的...
  • Kaggle入门:Digit Recognizer

    千次阅读 2017-03-02 10:24:43
    Kaggle入门:Digit Recognizer 数据是经典的lecun大神的mnist手写数字数据集。 ...数据分为三部分:训练数据、测试数据、提交数据格式示例 ...数据格式和lecun网站的数据格式有所不同,这里...Kaggle-DigitRecognizer
  • 前面一片博客介绍了使用logistic regression来实现kaggle上的手写识别,这篇博客继续介绍使用多层感知机来实现手写识别,并提高了正确率。写完上篇博客后,我去看了一些爬虫的东西(还没搞完),因此在40天后才有了...
  • // predictions.coalesce(1).saveAsTextFile("file:///media/common/工作/kaggle/DigitRecognizer/test_predict") // // 使用线性回归模型 // val lrModel = new LogisticRegressionWithLBFGS() // ....
  • [Kaggle]Digit Recognizer

    2019-04-07 21:44:32
    这同样是一道入门的KAGGLE题目。题目大意是给出一系列的灰度图像(用CSV表格表示像素),来预测该图像是何种数字。这是一个比较经典的图片,对应的方法有很多。可以使用传统的机器学习算法来进行计算,也可以使用...
  • DigitRecognizer(链接到Android应用程序)。 1.训练自定义分类器 加载数据 我们将使用作为tf.keras框架一部分的mnst数据。 (x_train, y_train), (x_test, y_test) = keras.datasets.mnist.load_data() 预处理数据 ...
  • 大家感兴趣的话,可以进群去下载数据,也可以直接到kaggle上进行下载,数据集名称是DigitRecognizer( https://www.kaggle.com/c/digit-recognizer)。那我们接下来,就用乳腺癌数据,来看看我们的调参代码。 1. ...
  • data = pd.read_csv('D://kaggle//DigitRecognizer//data//train.csv') images = data.iloc[:,1:].values images = images.astype(np.float) # convert from [0:255] => [0.0:1.0] images = np.multiply(images, ...
  • 1 概述 1.1 集成算法概述 集成学习(ensemble learning)是时下非常流行的机器学习算法,它本身不是一个单独的机器学习算法,而是通过在数据上构建多个模型,集成所有模型的建模结果。基本上所有的机器学习领域都...
  • """" ...""" #1.Libraries and settings import numpy as np import pandas as pd import matplotlib.pyplot as plt import matplotlib.cm as cm # %matplotlib inline import tensorflow as tf impor
  • Kaggle-Digit Recognizer

    2019-09-24 16:32:39
    train=pd.read_csv(r'E:\kaggle\DigitRecognizer\train.csv') test=pd.read_csv(r'E:\kaggle\DigitRecognizer\test.csv') #查看训练集信息 train.info() ‘pandas.core.frame.DataFrame’> RangeIndex: 42000...

空空如也

空空如也

1 2
收藏数 37
精华内容 14
关键字:

digitrecognizer