Skip to content

Code organization#3

Open
lucasbilobran wants to merge 3 commits into
masterfrom
bilobran
Open

Code organization#3
lucasbilobran wants to merge 3 commits into
masterfrom
bilobran

Conversation

@lucasbilobran

Copy link
Copy Markdown
Collaborator

First attempt to organize the code.

@lucasbilobran lucasbilobran requested a review from gitoso November 8, 2019 02:50

@gitoso gitoso left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Achei que a nova organização ficou maneira

Comment thread genetic.py
Comment on lines +65 to +95
def evaluateScore(C, data):
mathErrorFlag = False
avgScore = 0
count = 0
v = {'ID': 0, 'Cement': 0, 'Blasr': 0, 'FlyAsh': 0, 'Water': 0, 'Superplasticizer': 0, 'CoarseAggregate': 0, 'FineAggregate': 0, 'Age': 0}

for row in data:
v['ID'] = float(data[count][ID])
v['Cement'] = float(data[count][Cement])
v['Blasr'] = float(data[count][Blasr])
v['FlyAsh'] = float(data[count][FlyAsh])
v['Water'] = float(data[count][Water])
v['Superplasticizer'] = float(data[count][Superplasticizer])
v['CoarseAggregate'] = float(data[count][CoarseAggregate])
v['FineAggregate'] = float(data[count][FineAggregate])
v['Age'] = float(data[count][Age])

try:
calculated = eval(C.getExpression())
except:
mathErrorFlag = True
calculated = 0
score = (float(data[count][strenght]) - calculated) ** 2

avgScore = avgScore + score
count = count + 1

avgScore = avgScore / count
if isnan(avgScore) or mathErrorFlag:
avgScore = 999999999
C.setScore(avgScore)

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Eu não entendi a diferença entre essa função e a evaluateExpression()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants