<commit_before>---
layout: post
title: "HyからKerasを利用してMNISTを分類する(畳み込みニューラルネット版)"
description: ""
category: 
tags: [lisp,machine-learning]
---
{% include JB/setup %}

## 参考

- [https://github.com/fchollet/keras/blob/master/examples/mnist_cnn.py](https://github.com/fchollet/keras/blob/master/examples/mnist_cnn.py){:target="_blank"}
- [KerasでCIFAR-10の一般物体認識(人工知能に関する断創録)](http://aidiary.hatenablog.com/entry/20161127/1480240182){:target="_blank"}

## コード

```clojure
(import [keras [*]]
        [keras.datasets [mnist]]
        [keras.models [Sequential]]
        [keras.layers [Dense Dropout Flatten]]
        [keras.layers [Conv2D MaxPooling2D]]
        [keras [backend :as K]])

(import keras)

(setv batch-size  128
      num-classes 10
      epochs      12)

;; input image dimensions
(setv img-rows 28<commit_msg>Add new content<commit_after>---
layout: post
title: "HyからKerasを利用してMNISTを分類する(畳み込みニューラルネット版)"
description: ""
category: 
tags: [lisp,hy,machine-learning]
---
{% include JB/setup %}

## 参考

- [https://github.com/fchollet/keras/blob/master/examples/mnist_cnn.py](https://github.com/fchollet/keras/blob/master/examples/mnist_cnn.py){:target="_blank"}
- [KerasでCIFAR-10の一般物体認識(人工知能に関する断創録)](http://aidiary.hatenablog.com/entry/20161127/1480240182){:target="_blank"}

## コード

```clojure
(import [keras [*]]
        [keras.datasets [mnist]]
        [keras.models [Sequential]]
        [keras.layers [Dense Dropout Flatten]]
        [keras.layers [Conv2D MaxPooling2D]]
        [keras [backend :as K]])

(import keras)

(setv batch-size  128
      num-classes 10
      epochs      12)

;; input image dimensions
(setv img-rows 28
{'fraction_non_alphanumeric': 0.16270566727605118, 'fraction_numerical': 0.037781840341255334, 'mean_word_length': 3.8436578171091447, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3418345', 'n_tokens_mistral': 751, 'n_tokens_neox': 696, 'n_words': 97}