0% found this document useful (0 votes)
1 views17 pages

21mis1129 ch-4

The document contains a JSON representation of a data processing flow for a Decision Tree Classifier using the Iris dataset. It includes various nodes for injecting data, creating and loading datasets, training the classifier, and assessing its performance. The flow is designed to process the data, convert categorical features to numerical labels, and output predictions along with debugging information.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1 views17 pages

21mis1129 ch-4

The document contains a JSON representation of a data processing flow for a Decision Tree Classifier using the Iris dataset. It includes various nodes for injecting data, creating and loading datasets, training the classifier, and assessing its performance. The flow is designed to process the data, convert categorical features to numerical labels, and output predictions along with debugging information.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 17

CH-4

NAME: Kribha K

REGNO: 21MIS1129
JSON:

"id": "7da50d85c9141fc1",

"type": "tab",
"label": "Flow 5",

"disabled": false,

"info": "",

"env": []

},

"id": "738582be31663484",

"type": "inject",

"z": "7da50d85c9141fc1",

"name": "start",

"props": [

"p": "payload"

},

"p": "topic",

"vt": "str"

],

"repeat": "",

"crontab": "",

"once": false,

"onceDelay": 0.1,

"topic": "",

"payload": "",

"payloadType": "date",

"x": 90,

"y": 140,

"wires": [

"1bde403b00b7dbdd"
]

},

"id": "bd96b55c50ac1b26",

"type": "debug",

"z": "7da50d85c9141fc1",

"name": "debug 1",

"active": true,

"tosidebar": true,

"console": false,

"tostatus": false,

"complete": "false",

"statusVal": "",

"statusType": "auto",

"x": 560,

"y": 140,

"wires": []

},

"id": "1bde403b00b7dbdd",

"type": "create dataset",

"z": "7da50d85c9141fc1",

"name": "",

"path": "D:\\21MIS1021\\iris.csv",

"saveFolder": "D:\\21MIS1021\\dataset",

"saveName": "iris",

"input": "0,1,2,3",

"output": "2",

"trainingPartition": "",

"shuffle": "",
"seed": "",

"x": 320,

"y": 140,

"wires": [

"bd96b55c50ac1b26"

},

"id": "6c072581910cc828",

"type": "load dataset",

"z": "7da50d85c9141fc1",

"name": "",

"datasetFolder": "D:\\21MIS1021\\dataset",

"datasetName": "iris",

"partition": "train.csv",

"input": true,

"output": true,

"x": 310,

"y": 240,

"wires": [

"f9d35286898f193a"

],

"751b10c7a1286895"

},

{
"id": "c154b7798623b2aa",

"type": "inject",

"z": "7da50d85c9141fc1",

"name": "start",

"props": [

"p": "payload"

},

"p": "topic",

"vt": "str"

],

"repeat": "",

"crontab": "",

"once": false,

"onceDelay": 0.1,

"topic": "",

"payload": "",

"payloadType": "date",

"x": 90,

"y": 240,

"wires": [

"6c072581910cc828"

},

"id": "fc3823ff2f86799d",

"type": "decision tree classifier",


"z": "7da50d85c9141fc1",

"name": "Decision Tree Classfier Trainer",

"savePath": "D:\\21MIS1021\\models",

"saveName": "dtc.b",

"maxDepth": "",

"criterion": "gini",

"splitter": "best",

"x": 550,

"y": 240,

"wires": [

"ad894f1a03ddb94a"

],

"751b10c7a1286895"

},

"id": "ad894f1a03ddb94a",

"type": "debug",

"z": "7da50d85c9141fc1",

"name": "print",

"active": true,

"tosidebar": true,

"console": false,

"tostatus": false,

"complete": "payload",

"x": 750,

"y": 200,

"wires": []
},

"id": "751b10c7a1286895",

"type": "debug",

"z": "7da50d85c9141fc1",

"name": "error",

"active": true,

"tosidebar": true,

"console": false,

"tostatus": false,

"complete": "payload",

"x": 750,

"y": 300,

"wires": []

},

"id": "f9d35286898f193a",

"type": "function",

"z": "7da50d85c9141fc1",

"name": "function 1",

"func": "// Check if msg.payload is an array\nif (!Array.isArray(msg.payload)) {\n

node.error(\"Payload is not an array!\", msg);\n return;\n}\n\nlet dataset = msg.payload;\nlet

labelMap = global.get(\"labelMap\") || {}; // Store label encodings globally\nlet processedData =

dataset.map(row => {\n let newRow = {};\n for (let key in row) {\n let value = row[key];\n\n

// Convert input features to numbers\n if (isNaN(value) && typeof value === \"string\") {\n

if (!labelMap[key]) labelMap[key] = {}; // Initialize label map\n if (!labelMap[key][value])

labelMap[key][value] = Object.keys(labelMap[key]).length + 1;\n newRow[key] =

labelMap[key][value]; // Assign a numerical label\n } else if (!isNaN(value)) {\n


newRow[key]

= parseFloat(value); // Keep numeric values\n }\n }\n\n // Ensure the output label remains

categorical (string)\n newRow[\"output\"] = String(row[\"output\"]);\n\n return


newRow;\n});\n\n//
Save label encoding for future use\nglobal.set(\"labelMap\", labelMap);\n\n// Send processed data

forward\nmsg.payload = processedData;\nreturn msg;\n",

"outputs": 1,

"timeout": 0,

"noerr": 0,

"initialize": "",

"finalize": "",

"libs": [],

"x": 440,

"y": 320,

"wires": [

"fc3823ff2f86799d"

},

"id": "087c0319e70e5b98",

"type": "load dataset",

"z": "7da50d85c9141fc1",

"name": "",

"datasetFolder": "D:\\21MIS1021\\dataset",

"datasetName": "Iris",

"partition": "test.csv",

"input": false,

"output": true,

"x": 250,

"y": 420,

"wires": [

"26c97798120fd55d"
],

"79b16d9afc341fa3"

},

"id": "9368de00343dacd3",

"type": "inject",

"z": "7da50d85c9141fc1",

"name": "start",

"repeat": "",

"crontab": "",

"once": false,

"onceDelay": 0.1,

"topic": "",

"payload": "",

"payloadType": "date",

"x": 90,

"y": 420,

"wires": [

"087c0319e70e5b98",

"a9801cb4fcf43ac6"

},

"id": "26c97798120fd55d",

"type": "assessment",

"z": "7da50d85c9141fc1",
"name": "",

"score": "accuracy_score",

"x": 470,

"y": 420,

"wires": [

"f7be73b1f489b22f"

],

"79b16d9afc341fa3"

},

"id": "79b16d9afc341fa3",

"type": "debug",

"z": "7da50d85c9141fc1",

"name": "error",

"active": true,

"tosidebar": true,

"console": false,

"tostatus": false,

"complete": "payload",

"targetType": "msg",

"statusVal": "",

"statusType": "auto",

"x": 750,

"y": 440,

"wires": []

},

{
"id": "a9801cb4fcf43ac6",

"type": "load dataset",

"z": "7da50d85c9141fc1",

"name": "",

"datasetFolder": "D:\\21MIS1021\\dataset",

"datasetName": "Iris",

"partition": "test.csv",

"input": true,

"output": false,

"x": 150,

"y": 500,

"wires": [

"061c74d2e27ca0be"

],

"79b16d9afc341fa3"

},

"id": "061c74d2e27ca0be",

"type": "predictor",

"z": "7da50d85c9141fc1",

"name": "Decison Tree Classifier Prediction",

"modelPath": "D:\\21MIS1021\\models",

"modelName": "dtc.b",

"x": 540,

"y": 500,

"wires": [

[
"26c97798120fd55d"

],

"79b16d9afc341fa3"

},

"id": "f7be73b1f489b22f",

"type": "debug",

"z": "7da50d85c9141fc1",

"name": "print",

"active": true,

"tosidebar": true,

"console": false,

"tostatus": false,

"complete": "payload",

"targetType": "msg",

"statusVal": "",

"statusType": "auto",

"x": 650,

"y": 380,

"wires": []

},

"id": "1db82d6129240d7e",

"type": "comment",

"z": "7da50d85c9141fc1",

"name": "21MIS1129 Kribha K",

"info": "",

"x": 200,
"y": 340,

"wires": []

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy