Skip to content
Open
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
52 changes: 52 additions & 0 deletions challenge1/analysis/cpandrianatos/DataEntry.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
"""
@author Pavlo Andrianatos
Date: 11/02/2023
"""


class DataEntry:
ID: float
Label: float
House: float
Year: float
Month: float
Temperature: float
Daylight: float
EnergyProduction: float

"""
Each data entry represents one row in the dataset
"""
def __init__(self, id_num, label, house, year, month, temperature, daylight, energy_production):
self.ID = id_num
self.Label = label
self.House = house
self.Year = year
self.Month = month
self.Temperature = temperature
self.Daylight = daylight
self.EnergyProduction = energy_production

def getID(self):
return self.ID

def getLabel(self):
return self.Label

def getHouse(self):
return self.House

def getYear(self):
return self.Year

def getMonth(self):
return self.Month

def getTemperature(self):
return self.Temperature

def getDaylight(self):
return self.Daylight

def getEnergyProduction(self):
return self.EnergyProduction
31 changes: 31 additions & 0 deletions challenge1/analysis/cpandrianatos/DataReader.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import csv
from DataEntry import DataEntry

"""
@author Pavlo Andrianatos
Date: 11/02/2023
"""


class DataReader:
fileName: str

"""
The data reader will read the data in either the training set or test set, whichever the user provides
"""

def __init__(self, fileName):
self.fileName = fileName

def ReadInData(self) -> list:
data = []
with open("../../data/" + self.fileName) as csv_file:
csv_reader = csv.reader(csv_file, delimiter=',')
line_count = 0
for row in csv_reader:
if line_count == 0:
line_count += 1
else:
data.append(DataEntry(row[0], row[1], row[2], row[3], row[4], row[5], row[6], row[7]))
line_count += 1
return data
47 changes: 47 additions & 0 deletions challenge1/analysis/cpandrianatos/FunctionalNode.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
from Node import Node

"""
@author Pavlo Andrianatos
Date: 11/02/2023
"""


class FunctionalNode(Node):
label: str

children: list

"""
Possible operators + - * /
Each functional node will either have the mathematical operation plus, minus, multiply, or divide.
Functional nodes can either be the root or are situated above the terminal nodes.
Functional nodes have children (a max of 2).
"""

def __init__(self, label: str, children: list):
super().__init__()
self.label = label
self.children = children

def getLabel(self) -> str:
return self.label

def setLabel(self, newLabel: str):
self.label = newLabel

def getChildren(self) -> list:
return self.children

def setChildren(self, newChildren: list):
self.children = newChildren

# Count nodes from this node downwards, this a recursive function and is
# usually run from the root node downwards
def CountNodes(self) -> int:
c = 1
if not self.children:
return c
for i in range(0, len(self.children)):
if self.children[i] is not None:
c += self.children[i].CountNodes()
return c
Loading