Skip to content
This repository was archived by the owner on Nov 24, 2023. It is now read-only.
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"desc": "path to the file to be loaded.",
"functionName": "LOCAL_FILE",
"param": "file_path",
"value": "AI_ML/CLASSIFICATION/TORCHSCRIPT_CLASSIFIER/assets/President_Barack_Obama.jpg"
"value": "PYTHON/nodes/AI_ML/CLASSIFICATION/TORCHSCRIPT_CLASSIFIER/assets/President_Barack_Obama.jpg"
},
"file_type": {
"type": "select",
Expand Down Expand Up @@ -73,8 +73,8 @@
"dragging": true
},
{
"width": 225,
"height": 226,
"width": 380,
"height": 293,
"id": "IMAGE-b931ca30-e0fa-40c0-b7fd-bf3fd9d52ac0",
"type": "VISUALIZERS",
"data": {
Expand Down Expand Up @@ -115,8 +115,8 @@
"dragging": true
},
{
"width": 225,
"height": 226,
"width": 380,
"height": 293,
"id": "TABLE-f1d5b18c-5c89-4577-b460-53c7827703d4",
"type": "VISUALIZERS",
"data": {
Expand Down Expand Up @@ -173,7 +173,7 @@
"desc": "path to the file to be loaded.",
"functionName": "LOCAL_FILE",
"param": "file_path",
"value": "AI_ML/CLASSIFICATION/TORCHSCRIPT_CLASSIFIER/assets/class_names.csv"
"value": "PYTHON/nodes/AI_ML/CLASSIFICATION/TORCHSCRIPT_CLASSIFIER/assets/class_names.csv"
},
"file_type": {
"type": "select",
Expand Down Expand Up @@ -228,7 +228,7 @@
"dragging": true
},
{
"width": 231,
"width": 208,
"height": 96,
"id": "TORCHSCRIPT_CLASSIFIER-51ef4ad1-ce39-4cf8-84ed-0474f8a25283",
"type": "AI_ML",
Expand Down Expand Up @@ -286,8 +286,8 @@
"dragging": true
},
{
"width": 225,
"height": 226,
"width": 380,
"height": 293,
"id": "TABLE-a791e475-0516-453c-af76-33fa8864ff67",
"type": "VISUALIZERS",
"data": {
Expand Down Expand Up @@ -389,6 +389,5 @@
"i": "INPUT_PLACEHOLDER"
}
}
],
"textNodes": []
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"rfInstance": {
"nodes": [
{
"width": 160,
"height": 160,
"width": 150,
"height": 150,
"id": "LOCAL_FILE-37e74f08-bfb2-49d1-bec2-d962fda0f0a6",
"type": "LOADERS",
"data": {
Expand All @@ -17,7 +17,7 @@
"default": null,
"functionName": "LOCAL_FILE",
"param": "file_path",
"value": "AI_ML/IMAGE_CAPTIONING/NLP_CONNECT_VIT_GPT2/assets/President_Barack_Obama.jpg"
"value": "./PYTHON/nodes/AI_ML/IMAGE_CAPTIONING/NLP_CONNECT_VIT_GPT2/assets/President_Barack_Obama.jpg"
},
"file_type": {
"type": "select",
Expand Down Expand Up @@ -66,8 +66,8 @@
"dragging": true
},
{
"width": 208,
"height": 96,
"width": 150,
"height": 150,
"id": "NLP_CONNECT_VIT_GPT2-f4c9d884-68df-45a4-a06a-9c56750ff1c1",
"type": "AI_ML",
"data": {
Expand Down Expand Up @@ -106,8 +106,8 @@
"dragging": true
},
{
"width": 225,
"height": 226,
"width": 380,
"height": 293,
"id": "TABLE-15ab5a91-a962-4f8e-ba9c-8a159d576dbb",
"type": "VISUALIZERS",
"data": {
Expand Down Expand Up @@ -146,8 +146,8 @@
"dragging": true
},
{
"width": 225,
"height": 226,
"width": 380,
"height": 293,
"id": "IMAGE-ec76f3cf-6397-45cf-a1e0-ce43c89a9327",
"type": "VISUALIZERS",
"data": {
Expand Down Expand Up @@ -233,6 +233,5 @@
"i": "INPUT_PLACEHOLDER"
}
}
],
"textNodes": []
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"nodes": [
{
"width": 208,
"height": 96,
"height": 116,
"id": "HUGGING_FACE_PIPELINE-160a47cc-72e8-4088-a4af-43efdc9904d6",
"type": "AI_ML",
"data": {
Expand Down Expand Up @@ -78,7 +78,7 @@
"desc": "path to the file to be loaded",
"functionName": "LOCAL_FILE",
"param": "file_path",
"value": "AI_ML/IMAGE_CLASSIFICATION/HUGGING_FACE_PIPELINE/assets/ada_lovelace.png"
"value": "./PYTHON/nodes/AI_ML/IMAGE_CLASSIFICATION/HUGGING_FACE_PIPELINE/assets/ada_lovelace.png"
},
"file_type": {
"type": "select",
Expand Down Expand Up @@ -125,22 +125,22 @@
}
],
"path": "PYTHON/nodes/LOADERS/LOCAL_FILE_SYSTEM/LOCAL_FILE/LOCAL_FILE.py",
"selected": false
"selected": true
},
"position": {
"x": -405.26756052777466,
"y": -122.64869035489248
},
"selected": false,
"selected": true,
"positionAbsolute": {
"x": -405.26756052777466,
"y": -122.64869035489248
},
"dragging": true
},
{
"width": 225,
"height": 226,
"width": 380,
"height": 293,
"id": "TABLE-b1ca06f2-ecee-4858-a075-cdfb097be848",
"type": "VISUALIZERS",
"data": {
Expand Down Expand Up @@ -182,8 +182,8 @@
"dragging": true
},
{
"width": 225,
"height": 226,
"width": 380,
"height": 293,
"id": "IMAGE-b9af5a25-af44-43cd-bc00-315e08b0088f",
"type": "VISUALIZERS",
"data": {
Expand Down Expand Up @@ -253,6 +253,5 @@
"y": 575.2550328315427,
"zoom": 1.2199420644594634
}
},
"textNodes": []
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,53 +9,48 @@ def LEAST_SQUARES(
) -> Matrix | OrderedPair:


if b is None:
if isinstance(a, OrderedPair):
x = a.x
y = a.y
try:
a = np.vstack([x, np.ones(len(x))]).T
p = np.linalg.lstsq(a, y, rcond=None)[0]
except np.linalg.LinAlgError:
raise ValueError("Least Square Computation failed.")

slope, intercept = p[0:-1], p[-1]
res = slope * x + intercept

return OrderedPair(x=x, y=res)
else:
raise ValueError("For matrix type b must be specified!")
else:
if isinstance(a, OrderedPair) and isinstance(b, OrderedPair):
x = a.y
y = b.y

try:
a = np.vstack([x, np.ones(len(x))]).T
p = np.linalg.lstsq(a, y, rcond=None)[0]
except np.linalg.LinAlgError:
raise ValueError("Least Square Computation failed.")

slope, intercept = p[0:-1], p[-1]
print("=============== This is slope: ", slope)
print("=============== This is intercept: ", intercept)
res = slope * x + intercept

return OrderedPair(x=x, y=res)

elif isinstance(a, Matrix) and isinstance(b, Matrix):
x = a.m
y = b.m

try:
a = np.vstack([x, np.ones(len(x))]).T
p = np.linalg.lstsq(a, y, rcond=None)[0]
except np.linalg.LinAlgError:
raise ValueError("Least Square Computation failed.")

slope, intercept = p[0:-1], p[-1]
res = slope * x + intercept

return Matrix(m=res)
else:
raise ValueError("a and b must be of same type!")
if b is None and isinstance(a, OrderedPair):
x = a.x
y = a.y
try:
a = np.vstack([x, np.ones(len(x))]).T
p = np.linalg.lstsq(a, y, rcond=None)[0]
except np.linalg.LinAlgError:
raise ValueError("Least Square Computation failed.")

slope, intercept = p[0:-1], p[-1]
res = slope * x + intercept

return OrderedPair(x=x, y=res)

if isinstance(a, OrderedPair) and isinstance(b, OrderedPair):
x = a.y
y = b.y

try:
a = np.vstack([x, np.ones(len(x))]).T
p = np.linalg.lstsq(a, y, rcond=None)[0]
except np.linalg.LinAlgError:
raise ValueError("Least Square Computation failed.")

slope, intercept = p[0:-1], p[-1]
print("=============== This is slope: ", slope)
print("=============== This is intercept: ", intercept)
res = slope * x + intercept

return OrderedPair(x=x, y=res)

elif isinstance(a, Matrix) and isinstance(b, Matrix):
x = a.m
y = b.m

try:
a = np.vstack([x, np.ones(len(x))]).T
p = np.linalg.lstsq(a, y, rcond=None)[0]
except np.linalg.LinAlgError:
raise ValueError("Least Square Computation failed.")

slope, intercept = p[0:-1], p[-1]
res = slope * x + intercept

return Matrix(m=res)
1,029 changes: 888 additions & 141 deletions docs/nodes/LOADERS/REMOTE_FILE_SYSTEM/REMOTE_FILE/examples/EX1/app.json

Large diffs are not rendered by default.

Loading