Künstliche Intelligenz (KI) als Hobby / Artificial Intelligence (AI) as a Hobby

Facebook Gruppe: Künstliche Intelligenz (KI) als Hobby

Decision Tree learning in PHP

Basierend auf dem Projekt: ID3-PHP

Algorithmus: ID3 Wiki

Bei dern Lern-Methode Decision-Tree learning wird anhand von vergangenen Fallbeispielen (z.B. in Tabellenform) ein Entscheidungsbaum generiert, mit dem zukünftige Entscheidungen getroffen werden können sollen.

Einleitung

Bei dern Lern-Methode Decision-Tree learning wird anhand von vergangenen Fallbeispielen (z.B. in Tabellenform) ein Entscheidungsbaum generiert, mit dem zukünftige Entscheidungen getroffen werden können sollen.

Die Beispiel Daten basieren auf dieser .csv Datei: data.csv

Optional: eigene .csv Datei hochladen

Die CSV Datei muss den selben Aufbau haben, wie in dem Beispiel dargestellt. Letzte Spalte muss value heissen!

Die CSV Datei muss Komma-separiert sein.

Datei:
Using training data to generate Decision tree...
Decision tree using ID3:

Ausgabe aller Pfade des Entscheidungsbaums

Value of Vorhersage is sunny
Branch sunny exists and leads to node Feuchte
Value of Feuchte is high
Branch high exists and leads to node NO
Returning NO
Value of Vorhersage is sunny Branch sunny exists and leads to node Feuchte Value of Feuchte is high Branch high exists and leads to node NO Returning NO
Value of Vorhersage is overcast Branch overcast exists and leads to node YES Returning YES
Value of Vorhersage is rain Branch rain exists and leads to node Wind Value of Wind is weak Branch weak exists and leads to node YES Returning YES
Value of Vorhersage is rain Branch rain exists and leads to node Wind Value of Wind is weak Branch weak exists and leads to node YES Returning YES
Value of Vorhersage is rain Branch rain exists and leads to node Wind Value of Wind is strong Branch strong exists and leads to node NO Returning NO
Value of Vorhersage is overcast Branch overcast exists and leads to node YES Returning YES
Value of Vorhersage is sunny Branch sunny exists and leads to node Feuchte Value of Feuchte is high Branch high exists and leads to node NO Returning NO
Value of Vorhersage is sunny Branch sunny exists and leads to node Feuchte Value of Feuchte is normal Branch normal exists and leads to node YES Returning YES
Value of Vorhersage is rain Branch rain exists and leads to node Wind Value of Wind is weak Branch weak exists and leads to node YES Returning YES
Value of Vorhersage is sunny Branch sunny exists and leads to node Feuchte Value of Feuchte is normal Branch normal exists and leads to node YES Returning YES
Value of Vorhersage is overcast Branch overcast exists and leads to node YES Returning YES
Value of Vorhersage is overcast Branch overcast exists and leads to node YES Returning YES
Value of Vorhersage is rain Branch rain exists and leads to node Wind Value of Wind is strong Branch strong exists and leads to node NO Returning NO

Anhang: Ausgabe des Arrays aus der Input-Tabelle data.csv

Array
(
    [0] => Array
        (
            [Vorhersage] => sunny
            [Temperatur] => hot
            [Feuchte] => high
            [Wind] => weak
            [value] => no
            [result] => NO
        )

    [1] => Array
        (
            [Vorhersage] => sunny
            [Temperatur] => hot
            [Feuchte] => high
            [Wind] => strong
            [value] => no
            [result] => NO
        )

    [2] => Array
        (
            [Vorhersage] => overcast
            [Temperatur] => hot
            [Feuchte] => high
            [Wind] => weak
            [value] => yes
            [result] => YES
        )

    [3] => Array
        (
            [Vorhersage] => rain
            [Temperatur] => mild
            [Feuchte] => high
            [Wind] => weak
            [value] => yes
            [result] => YES
        )

    [4] => Array
        (
            [Vorhersage] => rain
            [Temperatur] => cool
            [Feuchte] => normal
            [Wind] => weak
            [value] => yes
            [result] => YES
        )

    [5] => Array
        (
            [Vorhersage] => rain
            [Temperatur] => cool
            [Feuchte] => normal
            [Wind] => strong
            [value] => no
            [result] => NO
        )

    [6] => Array
        (
            [Vorhersage] => overcast
            [Temperatur] => cool
            [Feuchte] => normal
            [Wind] => strong
            [value] => yes
            [result] => YES
        )

    [7] => Array
        (
            [Vorhersage] => sunny
            [Temperatur] => mild
            [Feuchte] => high
            [Wind] => weak
            [value] => no
            [result] => NO
        )

    [8] => Array
        (
            [Vorhersage] => sunny
            [Temperatur] => cool
            [Feuchte] => normal
            [Wind] => weak
            [value] => yes
            [result] => YES
        )

    [9] => Array
        (
            [Vorhersage] => rain
            [Temperatur] => mild
            [Feuchte] => normal
            [Wind] => weak
            [value] => yes
            [result] => YES
        )

    [10] => Array
        (
            [Vorhersage] => sunny
            [Temperatur] => mild
            [Feuchte] => normal
            [Wind] => strong
            [value] => yes
            [result] => YES
        )

    [11] => Array
        (
            [Vorhersage] => overcast
            [Temperatur] => mild
            [Feuchte] => high
            [Wind] => strong
            [value] => yes
            [result] => YES
        )

    [12] => Array
        (
            [Vorhersage] => overcast
            [Temperatur] => hot
            [Feuchte] => normal
            [Wind] => weak
            [value] => yes
            [result] => YES
        )

    [13] => Array
        (
            [Vorhersage] => rain
            [Temperatur] => mild
            [Feuchte] => high
            [Wind] => strong
            [value] => no
            [result] => NO
        )

)

Bewerte diese Seite

Sterne: 1 2 3 4 5 Was könnte besser sein: