AI Tutoriual for Beginners
In this tutorial you will learn in a few simple steps how to program and train a neural network. the training data set is so simple that you can train it on a normal PC or laptop within a few seconds.
If you look at the source code of the examples, you will notice that the comments in the source code are written in german. The reason is that I want to use this tutorial as a course at a student research center in Germany. Schülerforschungszentrum Berchtesgadener Land

Data is All You Need!
Data is the basis of machine learning! The quality of your data determines how well the trained AI will solve the task. the best neural network will never deliver a good result if it has been trained with incorrect or insufficient data!
Finding and processing the data is one of the most time-consuming steps in the development of AI systems. For this tutorial, of course, we're taking a much simpler approach: we're using a data set that has already been created for the training.
The Digits Dataset
Our training data set comes from the SCIKIT LEARN. Scikit-learn is a free machine learning software library for the Python programming language. It offers various classification, regression and clustering algorithms, including support vector machines, random forest, gradient boosting (such as XGBoost), k-means and DBSCAN. As SciKit (short for SciPy Toolkit), it is based on the numerical and scientific Python libraries NumPy and SciPy, as is Scikit-image, for example.

The digits dataset consists of 8x8 pixel images of digits. The images attribute of the dataset stores 8x8 arrays of grayscale values for each image. The target attribute of the dataset stores the digit each image represents.

Get to Know the Dataset
Loading the dataset is extremely easy: you just have to import it into your Python program. Of course you have to install the package first:
pip install scikit-learn
from sklearn import datasets digits = datasets.load_digits()To be able to take a closer look at the data set, we save the first 200 images as PNG - files in a subfolder “bilder”.
from sklearn import datasets import matplotlib.pyplot as plt digits = datasets.load_digits() # print(len(digits.images)) # Speichere die ersten 200 Bilder for i in range(200): image = digits.images[i] label = digits.target[i] filename = "bilder/bild" + str(i) + "_" + str(label) + ".png" plt.imsave(filename, image, cmap='gray') print("Bilder gespeichert!")We can also visualize the data set as a web page. The program generates a web page called “datensatz.html” and displays the 200 images with the corresponding label.
import os
# Es wird ein HTML Dokument , also eine Webseite erstellt
html_code = [ "<html<body>", "<h1>Dataset</h1>" ]
# all files in directory images
files = os.listdir("bilder")
for file in files:
#print(file)
label = file[-5]
html_code.append(f'<div style="display:inline-block; margin:5px;">')
html_code.append(f'<img src="bilder/{file}" style="width:64px; height:64px;"><br>')
html_code.append(f'Ziffer: {label}')
html_code.append('</div>')
html_code.append('\n')
html_code.append("