Cnn
This page includes ⊕ my Chapter notes for the book by Michael Nielsen.
import numpy as np
from sklearn import datasets, svm
from sklearn.model_selection import train_test_split
from sklearn.metrics import accuracy_score
iris = datasets.load_iris()
#X = iris.data[:, :2]
"""results:
SVC with linear kernel Accuracy: 0.80
LinearSVC (linear kernel) Accuracy: 0.78
SVC with RBF kernel Accuracy: 0.80
SVC with polynomial (degree 3) Accuracy: 0.78
SVC with Monster kernel Accuracy: 0.82
"""
X = iris.data[:, :3]
"""results:
SVC with linear kernel Accuracy: 1.00
LinearSVC (linear kernel) Accuracy: 0.98
SVC with RBF kernel Accuracy: 1.00
SVC with polynomial (degree 3) Accuracy: 0.96
SVC with Monster kernel Accuracy: 0.91
"""
#X = iris.data
#1.00 accuracy on all methods
y = iris.target
# train / test split.
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.3, random_state=42)
# random number generator
rng = np.random.RandomState(42)
D = 196883
W = rng.randn(X.shape[1], D) # creates random matrix of arg size
def monster_kernel(X1, X2): # produces pair-wise combinations of all feature vectors
X1_proj = np.dot(X1, W) # projects the 2,3 or 4 features into 198,883
X2_proj = np.dot(X2, W) # same here with same result
return np.dot(X1_proj, X2_proj.T) # returns the Gram Matrix
# Regularization parameter
C = 1.0
# Define models
models = [
# one vs. one classifier, with dual problem formulation. slower
("SVC with linear kernel", svm.SVC(kernel="linear", C=C)),
# one vs. rest. primal, faster.
("LinearSVC (linear kernel)", svm.LinearSVC(C=C, max_iter=10000)),
("SVC with RBF kernel", svm.SVC(kernel="rbf", gamma=0.7, C=C)),
("SVC with polynomial (degree 3)", svm.SVC(kernel="poly", degree=3, gamma="auto", C=C)),
("SVC with Monster kernel", svm.SVC(kernel=monster_kernel, C=C))
]
# Train, predict, and print accuracy
print("Classification Accuracy:\n")
for name, clf in models:
clf.fit(X_train, y_train)
y_pred = clf.predict(X_test)
acc = accuracy_score(y_test, y_pred)
print(f"{name:<40} Accuracy: {acc:.2f}")
This page is for finding a classifier on the KMNIST dataset. This dataset is more challenging than the original MNIST dataset that I have previously solved.
The details of the dataset can be found in the associated paper.
In short, since the reformation of the Japanese education in 1868, there became a standardisation of the kanji characters, and in the present day, most Japanese people cannot read the texts from 150 years ago.
An Embedded Notebook
Here is a table of all the research papers I have taken the liberty to print and annotate.
You may find the static directory here.
[1] | R. Manna and R. Nath. Kantian moral agency and the ethics of artificial intelligence. Problemos, 100:139--151, 2021. [ .pdf ] |
[2] | R. Nath and V. Sahu. The problem of machine ethics in artificial intelligence. AI & Society, 35:103--111, 2021. [ .pdf ] |
[3] | R. Tonkens. A challenge for machine ethics. Minds & Machines, 19:421--438, 2009. [ .pdf ] |
[4] | L. Singh. Automated kantian ethics: A faithful implementation, 2022. Online at https://github.com/lsingh123/automatedkantianethics. [ .pdf ] |
[5] | European Commission's High-Level Expert Group on Artificial Intelligence. Ethics guidelines for trustworthy artificial intelligence. Technical Report 6, European Commission, 2019. p. 17. [ .pdf ] |
[6] | J. Fjeld, N. Achten, H. Hilligoss, A. C. Nagy, and M. Srikumar. Principled artificial intelligence: Mapping consensus in ethical and rights-based approaches to principles for ai. arXiv preprint arXiv:2009.06350, 2020. [ .pdf ] |
[7] | M. M. Bentzen and F. Lindner. A formalization of kant's second formulation of the categorical imperative, 2018. [ arXiv | .pdf ] |
[8] | Tom M. Powers. Prospects for a Kantian machine. IEEE Intelligent Systems, 21(4):46--51, 2006. [ .pdf ] |
[9] | Christopher Bennett. What Is This Thing Called Ethics?, chapter 4--6. Routledge, London, 2015. Chapters on Utilitarianism, Kantian Ethics, and Aristotelian Virtue Ethics. |
[10] | Masaki Nakagawa. Deep learning for classical japanese literature. 2018. kmnist. [ .pdf ] |
[11] | Warren S. McCulloch and Walter Pitts. A logical calculus of the ideas immanent in nervous activity. 1943. McCulloch-Pitts Model, perceptron. [ .pdf ] |
[12] | Leland McInnes, John Healy, and James Melville. Umap: Uniform manifold approximation and projection for dimension reduction. 2020. [ .pdf ] |
[13] | Christian Szegedy, Wojciech Zaremba, and Ian Goodfellow. Intriguing properties of neural networks. 2014. [ .pdf ] |
[14] | Alec Radford, Jeffrey Wu, Rewon Child, David Luan, Dario Amodei, and Ilya Sutskever. Language models are unsupervised multitask learners. 2019. GPT-2. [ .pdf ] |
[15] | Alec Radford, Karthik Narasimhan, Tim Salimans, and Ilya Sutskever. Improving language understanding by generative pre-training. 2018. GPT. [ .pdf ] |
[16] | Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N. Gomez, Lukasz Kaiser, and Illia Polosukhin. Attention is all you need. In Advances in Neural Information Processing Systems, 2017. Attention, Transformer. [ .pdf ] |
[17] | Ilya Sutskever, Oriol Vinyals, and Quoc V. Le. Sequence to sequence learning with neural networks. In Advances in Neural Information Processing Systems, 2014. Seq2Seq. [ .pdf ] |
[18] | Karen Simonyan and Andrew Zisserman. Very deep convolutional networks for large-scale image recognition. In International Conference on Learning Representations, 2015. VGGNet. [ .pdf ] |
[19] | Alex Krizhevsky, Ilya Sutskever, and Geoffrey E. Hinton. Imagenet classification with deep convolutional neural networks. In Advances in Neural Information Processing Systems, 2012. AlexNet. [ .pdf ] |
[20] | Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, 2015. ResNet. [ .pdf ] |
[21] | Yann LeCun, Yoshua Bengio, and Geoffrey Hinton. Deep learning. Nature, 521:436--444, 2015. Review: Deep Learning. [ .pdf ] |
[22] | Yann LeCun, Léon Bottou, Yoshua Bengio, and Patrick Haffner. Gradient-based learning applied to document recognition. Proceedings of the IEEE, 1998. LeNet. [ .pdf ] |
[23] | Stephan K. Chalup and Alan D. Blair. Incremental training of first order recurrent neural networks to predict a context-sensitive language. 2003. [ .pdf ] |
[24] | Nicholas Heller and Niranjan Sathiananathen. The kits19 challenge data, 2020. [ .pdf ] |
[25] | Yann LeCun, Bernhard Boser, John S. Denker, Donnie Henderson, Richard E. Howard, Wayne Hubbard, and Lawrence D. Jackel. Handwritten digit recognition with a back-propagation network. 1989. [ .pdf ] |
[26] | Ahmed Taha, Pechin Lo, and Junning Li. Convolution networks for kidney vessels segmentation from ct-volumes. 2018. KidNet. [ .pdf ] |
[27] | Olaf Ronneberger, Philipp Fischer, and Thomas Brox. U-net: Convolutional networks for biomedical image segmentation. In Medical Image Computing and Computer-Assisted Intervention (MICCAI), 2015. UNet. [ .pdf ] |
[28] | Niranjan J. Sathianathen, Nicholas Heller, Samuel Kleppe, James M. Mountney, and Bradley Erickson. Automatic segmentation of kidneys and kidney tumors: The kits19 international challenge. 2022. [ .pdf ] |
[29] | DeepSeek-AI et al. Deepseek-r1: Incentivizing reasoning capability in llms via reinforcement learning, 2025. [ .pdf ] |
[30] | Batya Friedman, Peter H. Kahn, and Alan Borning. Value sensitive design. In Proceedings of the 2006 ACM Conference on Human Factors in Computing Systems, 2006. Foundational work on incorporating human values into design. [ .pdf ] |
[31] | Ben Shneiderman. Human-centered artificial intelligence: Reliable, safe & trustworthy, 2020. [ .pdf ] |
[32] | Ricardo Baeza-Yates. Bias in web data and use taints the algorithms behind web-based applications, delivering equally biased results. Communications of the ACM, 61(6):54--61, 2018. Available at https://dl.acm.org/doi/pdf/10.1145/3209581. [ DOI | .pdf ] |
[33] | Sorelle A. Friedler, Carlos Scheidegger, and Suresh Venkatasubramanian. On the (im)possibility of fairness: Different value systems require different mechanisms for fair decision-making, 2016. Workshop version at FAccT 2016; available at https://arxiv.org/abs/1609.07236. [ arXiv | .pdf ] |