Update, moved readme.

main
Gijs 3 years ago
parent d0cb45bce2
commit b02ea735b4

@ -1,57 +0,0 @@
#pragma once
#include <cstdarg>
namespace PublishingHouse
{
namespace RandomForest
{
class TreeOfUnease
{
public:
const char* traverse(float (*getObservationValue)(int), bool (*considerWithUnease)(const char*, float, int, float))
{
if ((considerWithUnease)("Message", (getObservationValue)(3), 3, 1.0)) {
if ((considerWithUnease)("Message", (getObservationValue)(1), 1, 3.1)) {
if ((considerWithUnease)("Message", (getObservationValue)(2), 2, 1.3)) {
return "Iris Setosa";
}
else {
return "Iris Setosa";
}
}
else {
return "Iris Setosa";
}
}
else {
if ((considerWithUnease)("Message", (getObservationValue)(3), 3, 1.8)) {
if ((considerWithUnease)("Message", (getObservationValue)(2), 2, 5.6)) {
if ((considerWithUnease)("Message", (getObservationValue)(3), 3, 1.5)) {
if ((considerWithUnease)("Message", (getObservationValue)(3), 3, 1.3)) {
if ((considerWithUnease)("Message", (getObservationValue)(1), 1, 2.2)) {
return "Iris Versicolour";
}
else {
return "Iris Versicolour";
}
}
else {
return "Iris Versicolour";
}
}
else {
return "Iris Versicolour";
}
}
else {
return "Iris Virginica";
}
}
else {
return "Iris Virginica";
}
}
}
private:
};
}
}

@ -9,9 +9,9 @@ namespace PublishingHouse
public:
const char* traverse(float (*getObservationValue)(int), bool (*considerWithUnease)(const char*, float, int, float))
{
if ((considerWithUnease)("Meise herbarium",(getObservationValue)(3), 3, 1.0)) {
if ((considerWithUnease)("About their « living herbarium »",(getObservationValue)(3), 3, 0.2)) {
if ((considerWithUnease)("Some of plants there come from Leopold II his garden",(getObservationValue)(3), 3, 0.1)) {
if ((considerWithUnease)("I have a thought about the Meise herbarium...",(getObservationValue)(3), 3, 1.0)) {
if ((considerWithUnease)("...about their « living herbarium »...",(getObservationValue)(3), 3, 0.2)) {
if ((considerWithUnease)("...some of plants there come from Leopold II his garden:",(getObservationValue)(3), 3, 0.1)) {
return "Iris Setosa";
}
else {
@ -23,9 +23,9 @@ namespace PublishingHouse
}
}
else {
if ((considerWithUnease)("About the creation of its herbarium",(getObservationValue)(2), 2, 4.8)) {
if ((considerWithUnease)("The basis of the Meise Collection is an herbarium of the plants from Brazil",(getObservationValue)(2), 2, 4.6)) {
if ((considerWithUnease)("Leopold 2 bought it to assess whether to make Brazil a colony. But he chose Congo instead",(getObservationValue)(2), 2, 3.9)) {
if ((considerWithUnease)("...about the creation of its herbarium...",(getObservationValue)(2), 2, 4.8)) {
if ((considerWithUnease)("...the basis of the Meise Collection is an herbarium of the plants from Brazil...",(getObservationValue)(2), 2, 4.6)) {
if ((considerWithUnease)("...Leopold II bought it to assess Brazil as a colony. But he chose Congo instead",(getObservationValue)(2), 2, 3.9)) {
return "?";
}
else {
@ -37,8 +37,8 @@ namespace PublishingHouse
}
}
else {
if ((considerWithUnease)("Most of Meise specimens were acquired when you did not need permission from local communities to collect plants",(getObservationValue)(1), 1, 2.7)) {
if ((considerWithUnease)("This seems to change with frameworks such as the Nagoya Protocol and the convention on biological diversity",(getObservationValue)(2), 2, 5.0)) {
if ((considerWithUnease)("...most specimens were acquired when permission from local communities wasnt required…",(getObservationValue)(1), 1, 2.7)) {
if ((considerWithUnease)("...this seems to change with frameworks such as the Nagoya Protocol and the convention on biological diversity",(getObservationValue)(2), 2, 5.0)) {
return "?";
}
else {
@ -46,7 +46,7 @@ namespace PublishingHouse
}
}
else {
if ((considerWithUnease)("And there does not seem to be project to give them back to the countries they were collected from",(getObservationValue)(2), 2, 5.1)) {
if ((considerWithUnease)("…and there does not seem to be project to give them back to the countries they were collected from",(getObservationValue)(2), 2, 5.1)) {
return "?";
}
else {

@ -9,9 +9,9 @@ namespace PublishingHouse
public:
const char* traverse(float (*getObservationValue)(int), bool (*considerWithUnease)(const char*, float, int, float))
{
if ((considerWithUnease)("Meise Data",(getObservationValue)(2), 2, 3.3)) {
if ((considerWithUnease)("About their digital portal",(getObservationValue)(2), 2, 1.4)) {
if ((considerWithUnease)("The fields used to describe the specimens seem restrictive",(getObservationValue)(3), 3, 0.1)) {
if ((considerWithUnease)("But on the data of Meise…",(getObservationValue)(2), 2, 3.3)) {
if ((considerWithUnease)("...and their digital portal...",(getObservationValue)(2), 2, 1.4)) {
if ((considerWithUnease)("...the fields used to describe the specimens seem restrictive",(getObservationValue)(3), 3, 0.1)) {
return "Iris Setosa";
}
else {
@ -23,8 +23,8 @@ namespace PublishingHouse
}
}
else {
if ((considerWithUnease)("About the content of the dataset",(getObservationValue)(2), 2, 4.8)) {
if ((considerWithUnease)("One of Meises expertise is coffee and they gather a lot of data about it",(getObservationValue)(3), 3, 1.0)) {
if ((considerWithUnease)("...and the content of the dataset…",(getObservationValue)(2), 2, 4.8)) {
if ((considerWithUnease)("...one of Meises expertise is coffee and they gather a lot of data about it",(getObservationValue)(3), 3, 1.0)) {
return "Iris Versicolour";
}
else {
@ -32,8 +32,8 @@ namespace PublishingHouse
}
}
else {
if ((considerWithUnease)("The repartition of the samples is quite telling",(getObservationValue)(2), 2, 4.9)) {
if ((considerWithUnease)("1,5 % of type specimen were collected in Belgium, 22 % in RDC, 18 % in Brazil",(getObservationValue)(0), 0, 6.2)) {
if ((considerWithUnease)("...the repartition of the samples is quite telling...",(getObservationValue)(2), 2, 4.9)) {
if ((considerWithUnease)("...1,5 % of type specimen were collected in Belgium, 22 % in RDC, 18 % in Brazil",(getObservationValue)(0), 0, 6.2)) {
return "Iris Versicolour";
}
else {
@ -41,7 +41,7 @@ namespace PublishingHouse
}
}
else {
if ((considerWithUnease)("and mirrors the history of Botany",(getObservationValue)(3), 3, 1.8)) {
if ((considerWithUnease)("...and mirrors the history of Botany",(getObservationValue)(3), 3, 1.8)) {
return "?";
}
else {

@ -9,9 +9,9 @@ namespace PublishingHouse
public:
const char* traverse(float (*getObservationValue)(int), bool (*considerWithUnease)(const char*, float, int, float))
{
if ((considerWithUnease)("Classification",(getObservationValue)(3), 3, 1.0)) {
if ((considerWithUnease)("About the need for models",(getObservationValue)(1), 1, 3.0)) {
if ((considerWithUnease)("What is simple is always wrong. What is not is unusable. Paul Valéry 1942",(getObservationValue)(0), 0, 4.4)) {
if ((considerWithUnease)("I feel unease on classification...",(getObservationValue)(3), 3, 1.0)) {
if ((considerWithUnease)("...about the need for models…",(getObservationValue)(1), 1, 3.0)) {
if ((considerWithUnease)("...what is simple is always wrong. What is not is unusable. Paul Valéry 1942",(getObservationValue)(0), 0, 4.4)) {
return "Iris Setosa";
}
else {
@ -23,9 +23,9 @@ namespace PublishingHouse
}
}
else {
if ((considerWithUnease)("About modeling from observations",(getObservationValue)(3), 3, 1.8)) {
if ((considerWithUnease)("it seems that we are reducing plants to a few numbered characteristics",(getObservationValue)(3), 3, 1.5)) {
if ((considerWithUnease)("Why not apply the same to humans ?",(getObservationValue)(3), 3, 1.4)) {
if ((considerWithUnease)("...about modeling from observations…",(getObservationValue)(3), 3, 1.8)) {
if ((considerWithUnease)("...it seems that we are reducing plants to a few numbered characteristics",(getObservationValue)(3), 3, 1.5)) {
if ((considerWithUnease)("...why not apply the same to humans ?",(getObservationValue)(3), 3, 1.4)) {
return "?";
}
else {
@ -33,7 +33,7 @@ namespace PublishingHouse
}
}
else {
if ((considerWithUnease)("Is the practice of categorisation bad in itself ?",(getObservationValue)(1), 1, 3.0)) {
if ((considerWithUnease)("...is the practice of categorisation bad in itself ?",(getObservationValue)(1), 1, 3.0)) {
return "?";
}
else {

@ -9,10 +9,10 @@ namespace PublishingHouse
public:
const char* traverse(float (*getObservationValue)(int), bool (*considerWithUnease)(const char*, float, int, float))
{
if ((considerWithUnease)("Iris Dataset",(getObservationValue)(2), 2, 3.5)) {
if ((considerWithUnease)("About the iris Dataset",(getObservationValue)(1), 1, 4.0)) {
if ((considerWithUnease)("Its origin are troubling to say the least",(getObservationValue)(1), 1, 3.0)) {
if ((considerWithUnease)("It was first published in the Annals of Eugenics… Is it wrong to display it ?",(getObservationValue)(2), 2, 1.4)) {
if ((considerWithUnease)("There is something with the Iris Dataset",(getObservationValue)(2), 2, 3.5)) {
if ((considerWithUnease)("...its origin are troubling to say the least…",(getObservationValue)(1), 1, 4.0)) {
if ((considerWithUnease)("...it was first published in the Annals of Eugenics… Is it wrong to display it ?",(getObservationValue)(1), 1, 3.0)) {
if ((considerWithUnease)("",(getObservationValue)(2), 2, 1.4)) {
return "Iris Setosa";
}
else {
@ -28,7 +28,22 @@ namespace PublishingHouse
}
}
else {
return "?";
if ((considerWithUnease)("...species in this dataset are lineraly separable.. ",(getObservationValue)(3), 3, 1.8)) {
if ((considerWithUnease)("...which make classification algorithms reach perfect accuracy…",(getObservationValue)(0), 0, 5.7)) {
if ((considerWithUnease)("...this also explains why it is so popular in Machine Learning education.",(getObservationValue)(0), 0, 5.2)) {
return "Iris Versicolour";
}
else {
return "Iris Versicolour";
}
}
else {
return "Iris Versicolour";
}
}
else {
return "Iris Virginica";
}
}
}
private:

@ -9,10 +9,10 @@ namespace PublishingHouse
public:
const char* traverse(float (*getObservationValue)(int), bool (*considerWithUnease)(const char*, float, int, float))
{
if ((considerWithUnease)("Meise herbarium",(getObservationValue)(2), 2, 3.3)) {
if ((considerWithUnease)("About their « living herbarium »",(getObservationValue)(0), 0, 5.1)) {
if ((considerWithUnease)("Some of plants there come from Leopold II his garden",(getObservationValue)(3), 3, 0.2)) {
if ((considerWithUnease)("They dont specify it, but you can infer it from their signs",(getObservationValue)(3), 3, 0.1)) {
if ((considerWithUnease)("I have a thought about the Meise herbarium...",(getObservationValue)(2), 2, 3.3)) {
if ((considerWithUnease)("...about their « living herbarium »...",(getObservationValue)(0), 0, 5.1)) {
if ((considerWithUnease)("...some of plants there come from Leopold II his garden:",(getObservationValue)(3), 3, 0.2)) {
if ((considerWithUnease)("...they dont specify it, but you can infer it from their signs",(getObservationValue)(3), 3, 0.1)) {
return "Iris Setosa";
}
else {
@ -28,9 +28,9 @@ namespace PublishingHouse
}
}
else {
if ((considerWithUnease)("About the creation of its herbarium",(getObservationValue)(3), 3, 1.8)) {
if ((considerWithUnease)("The basis of the Meise Collection is an herbarium of the plants from Brazil",(getObservationValue)(3), 3, 1.6)) {
if ((considerWithUnease)("Leopold 2 bought it to assess whether to make Brazil a colony. But he chose Congo instead",(getObservationValue)(0), 0, 6.1)) {
if ((considerWithUnease)("...about the creation of its herbarium...",(getObservationValue)(3), 3, 1.8)) {
if ((considerWithUnease)("...the basis of the Meise Collection is an herbarium of the plants from Brazil...",(getObservationValue)(3), 3, 1.6)) {
if ((considerWithUnease)("...Leopold II bought it to assess Brazil as a colony. But he chose Congo instead",(getObservationValue)(0), 0, 6.1)) {
return "?";
}
else {
@ -38,7 +38,7 @@ namespace PublishingHouse
}
}
else {
if ((considerWithUnease)("JSB Pohl contributed to it with 1479 specimens. He also brought back a pair of indigenous people.",(getObservationValue)(1), 1, 3.3)) {
if ((considerWithUnease)("...JSB Pohl contributed to it with 1479 specimens. He also brought back a pair of indigenous people.",(getObservationValue)(1), 1, 3.3)) {
return "Iris Virginica";
}
else {
@ -47,8 +47,8 @@ namespace PublishingHouse
}
}
else {
if ((considerWithUnease)("Most of Meise specimens were acquired when you did not need permission from local communities to collect plants",(getObservationValue)(2), 2, 4.9)) {
if ((considerWithUnease)("This seems to change with frameworks such as the Nagoya Protocol and the convention on biological diversity",(getObservationValue)(0), 0, 6.0)) {
if ((considerWithUnease)("...most specimens were acquired when permission from local communities wasnt required…",(getObservationValue)(2), 2, 4.9)) {
if ((considerWithUnease)("...this seems to change with frameworks such as the Nagoya Protocol and the convention on biological diversity",(getObservationValue)(0), 0, 6.0)) {
return "Iris Versicolour";
}
else {

@ -33,16 +33,16 @@
#include <esp_now.h>
#include <WiFi.h>
//#include "unease.h"
#include "Tree_0.h"
#include "Tree_of_unease_0.h"
//#include "Tree_0.h"
//#include "Tree_of_unease_0.h"
//#include "Tree_1.h"
//#include "Tree_of_unease_1.h"
//#include "Tree_2.h"
//#include "Tree_of_unease_2.h"
//#include "Tree_3.h"
//#include "Tree_of_unease_3.h"
//#include "Tree_4.h"
//#include "Tree_of_unease_4.h"
#include "Tree_4.h"
#include "Tree_of_unease_4.h"
PublishingHouse :: RandomForest :: TreeOfUnease treeOfUnease;
PublishingHouse :: RandomForest :: DecisionTree tree;
@ -51,7 +51,7 @@ PublishingHouse :: RandomForest :: DecisionTree tree;
//const int randSeed = 6730/;
const int featureCount = 4;
const int treeNumber = 0;
const int treeNumber = 4;
int considerationStep = 0;
String considerationTraces = String();
const int verticalOffset = 19;
@ -226,6 +226,7 @@ bool considerWithUnease(const char *unease, float value, int feature, float thre
void classify ()
{
considerationStep = 0;
considerationTraces = String();
Serial.println("Starting classification");
if (random(3) == 0) {
treeOfUnease.traverse(&getObservationValue, &considerWithUnease);

@ -5,7 +5,7 @@
#include <stdlib.h>
#include <time.h>
const int timeBetweenBroadcasts = 5 * 60 * 1000;
const int timeBetweenBroadcasts = 150 * 1000;
uint8_t broadcastAddress[] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
void OnDataSent(const uint8_t *mac_addr, esp_now_send_status_t status) {
@ -60,7 +60,8 @@ void setup()
if (esp_now_add_peer(&peerInfo) != ESP_OK){
Serial.println("Failed to add peer");
for(;;) { delay(1); } // do not initialize wait forever
}
}
delay(10 * 1000);
}
float pickedObservation[observationFeatureCount];

Loading…
Cancel
Save