Fixed input scaling bugs delay prediction model

This commit is contained in:
Hunter Nichols 2020-12-07 14:36:01 -08:00
parent 77d7e3b1cf
commit 8a75b83889
2 changed files with 8 additions and 8 deletions

View File

@ -585,11 +585,14 @@ class lib:
def compute_delay(self):
"""Compute SRAM delays for current corner"""
if self.use_model:
import math
#FIXME: ML models only designed for delay. Cannot produce all values for Lib
d = linear_regression()
model_inputs = [OPTS.num_words,
temp_wpr = 2.0 #OPTS not working right now
log_num_words = math.log(OPTS.num_words, 2)
model_inputs = [log_num_words,
OPTS.word_size,
OPTS.words_per_row,
temp_wpr,
self.sram.width * self.sram.height]
char_results = d.get_prediction(model_inputs)

View File

@ -22,17 +22,14 @@ class linear_regression():
def __init__(self):
self.model = None
def get_prediction(self, model_inputs):
train_sets = []
test_sets = []
def get_prediction(self, model_inputs):
file_path = data_dir +'/'+data_filename
scaled_inputs = np.asarray(scale_input_datapoint(model_inputs, data_dir))
scaled_inputs = np.asarray([scale_input_datapoint(model_inputs, data_dir)])
features, labels = get_scaled_data(file_path, data_dir)
self.train_model(features, labels)
scaled_pred = model_prediction(model_inputs)
scaled_pred = self.model_prediction(scaled_inputs)
pred = unscale_data(scaled_pred.tolist(), data_dir)
debug.info(1,"Unscaled Prediction = {}".format(pred))
return pred