//////////////////////////////////////////////////////////////

JSON Automation

___________________________________________________________

maXbox Starter 85 — JSON Automation with Json4Delphi

There are two kinds of data scientists:

1) Those who can extrapolate from incomplete data.

Reading JSON data in maXbox or Lazarus should be easy with the right class. JSON can be read from a string, file or it could be a JSON link see later on.

But what’s JSON: JSON (JavaScript Object Notation) is a lightweight data-interchange format. It is easy for humans to read and write at least as a text. It is easy for machines to parse and generate, but not so easy to interpret for humans.

Lets start with a simple sample:


MNIST Single Prediction

For this tutor we’ll explore one of the classic machine learning datasets — hand written digits classification.

https://github.com/maxkleiner/maXbox4/blob/master/MNISTSinglePredict.ipynb

We have set up a very simple SVC to classify the MNIST digits to make one single predict. First we load the libraries and the dataset:

#sign:max: MAXBOX8: 13/03/2021 07:46:37
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from sklearn import tree
from sklearn.svm import SVC
from sklearn.ensemble import RandomForestClassifier
from sklearn import datasets
from sklearn.metrics import accuracy_score
from sklearn.model_selection import train_test_split

The dataset is available either for download from the UCI ML repository or via a Python…


maXbox Starter 82_2 — How to make a Sentiment Analysis, Max Kleiner

“Yesterday I was clever, so I wanted to change the world. Today I am wise, so I am changing myself.” — Rumi

As you way know, we went through the last magazine report on the BBC News feed, line by line in a maXbox shellbook; now we want to equip and enlarge these texts with a sentiment analysis like the following:

11: French MP and billionaire Olivier Dassault dies in helicopter crash:
Sun, 07 Mar 2021 20:04:17 GMT
{"probability": {"neg": 0.46705201547833042, "neutral": 0.81510771060379195, "pos": 0.53294798452166958}, "label": "neutral"}

So the label shows neutral in the middle of possibilities. The english sentiment…


maXbox Starter 82 — JSON in Code


The model below this article depicts the architecture for a multilayer perceptron network designed specifically to solve the XOR problem, but all the remaining 15 logic-problems too. This I want to show with all the solutions of the FANN Library implementation in 3 steps: Build, Train and Test the NN.

A detailed report of this Classifier is available at: http://www.softwareschule.ch/download/maxbox_starter56.pdf

Fast Artificial Neural Network (FANN) Library is a free open source neural network library, which implements multilayer artificial neural networks in C , Pascal or Python with support for both fully connected and sparsely connected networks.


Mainz Southbridge

Bayes’ theorem is crucial for interpreting the results from binary classification algorithms.

We will show that Bayes’ theorem is simply the relationship between precision and recall (precisely it is the precision), then we can turn the process into an equation, which is Bayes’ Theorem. It lets you take the test results and correct for the “skew” introduced by false positives. Let me show that with some real numbers of a confusion matrix.

print(confusion_matrix(y_test, y_pred))
print(classification_report(y_test, y_pred))

dtype: int64
[[ 39 32] 71 = A = 0
[ 22 222]] 244 =B = 1
254 315

___________Predict
Actual 0 [[ 39…


Posted on February 1, 2021 by maxbox4

Version:0.9 StartHTML:0000000105 EndHTML:0000046646


There’s a course about computational geometry which I scripted from the source in maXbox. The origin you can find at:

http://www.delphiforfun.org/programs/Library/geometry1.htm

The script with the 9 Tasks in one file you can find at:

http://www.softwareschule.ch/examples/geometry.txt

Three new routines were added to the UGeometry unit today and Version 3 of the Geometry test program illustrates their use. The routines, PolygonArea, InflatePolygon, and PolygonClockwise help to “inflate” (or deflate) a given polygon by given amount. The value is the distance which the edges are to be moved while retaining their slope.


Nearly all photons emitted after Big Bang (in digit quant called BitBang) are now visible only at far-infrared wavelengths. This includes light from the cold universe of gas and dust from which stars and planets form, as well as faint signals from distant galaxies tracing the universe’s evolution to today.


//////////////////////////////////////////////////////////////////

PPM Crossplatform Images

maXbox Starter 78 — The Portable Pixmap Format

Today I want to introduce a system independent image format for any images, machine learning data like feature maps in a CNN or just to exchange picture data on various platforms.

The Portable Pixmap format uses an uncompressed and inefficient format so that it is seldom used for storing large images but on the other side this is an advantage. We use this format for converting system-independent images to machine learning feature maps in a CNN (Convolutional Neural Network).

Besides PPM, other 2 popular Netpbm file formats include the portable bitmap…

Max Kleiner

Max Kleiner's professional environment is in the areas of OOP, UML and coding - among other things as a trainer, developer and consultant.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store