|
|
|
@ -578,18 +578,20 @@ class Predict(GNet):
|
|
|
|
|
# if we are dealing with numeric values only we can perform a simple marginal sum against the indexes
|
|
|
|
|
# The code below will insure we have some acceptable cardinal relationships between id and synthetic values
|
|
|
|
|
#
|
|
|
|
|
df = pd.DataFrame(np.round(f).astype(np.int32))
|
|
|
|
|
|
|
|
|
|
df = pd.DataFrame(np.round(f)).astype(np.int32)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
p = 0 not in df.sum(axis=1).values
|
|
|
|
|
x = df.sum(axis=1).values
|
|
|
|
|
|
|
|
|
|
if np.divide( np.sum(x), x.size) > .9 or p and np.sum(x) == x.size and x.size == self.values.size:
|
|
|
|
|
if np.divide( np.sum(x), x.size) > .9 or p and np.sum(x) == x.size :
|
|
|
|
|
ratio.append(np.divide( np.sum(x), x.size))
|
|
|
|
|
found.append(df)
|
|
|
|
|
if i == CANDIDATE_COUNT:
|
|
|
|
|
break
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
|
|
continue
|
|
|
|
|
|
|
|
|
|
# i = df.T.index.astype(np.int32) #-- These are numeric pseudonyms
|
|
|
|
@ -597,9 +599,13 @@ class Predict(GNet):
|
|
|
|
|
#
|
|
|
|
|
# In case we are dealing with actual values like diagnosis codes we can perform
|
|
|
|
|
#
|
|
|
|
|
_index = [found.index(item) for item in found if item.shape[1] == len(self.values)]
|
|
|
|
|
if not _index :
|
|
|
|
|
INDEX = np.random.choice(np.arange(len(found)),1)[0]
|
|
|
|
|
INDEX = ratio.index(np.max(ratio))
|
|
|
|
|
else:
|
|
|
|
|
INDEX = _index[0]
|
|
|
|
|
|
|
|
|
|
INDEX = np.random.choice(np.arange(len(found)),1)[0]
|
|
|
|
|
INDEX = ratio.index(np.max(ratio))
|
|
|
|
|
|
|
|
|
|
df = found[INDEX]
|
|
|
|
|
columns = self.ATTRIBUTES['synthetic'] if isinstance(self.ATTRIBUTES['synthetic'],list)else [self.ATTRIBUTES['synthetic']]
|
|
|
|
|