doepy icon indicating copy to clipboard operation
doepy copied to clipboard

Float precision

Open jeannotalpin opened this issue 4 years ago • 1 comments

In doe_function.construct_df, the pandas dataframe is forced to be of dtype=float32. This leads to a non-negligeable loss of accuracy. Double float are common now in all applications.

Is there any reason for this dtype specification?

  • If yes, I would propose to make it an option
  • If no, I would propose to remove it and let pandas handle the dtype from the given array.

Thanks.

jeannotalpin avatar Sep 01 '21 09:09 jeannotalpin

Hello,

I modified it for my purpose this way, now it seems to support strings and integers correctly:

def construct_df(x,r):
    """
    Function for constructing a DataFrame from a numpy array generated by PyDOE function and individual lists
    """
    df=pd.DataFrame(data=np.empty_like(x, dtype=object), dtype='object')
    for i in df.index:
        for j in range(len(list(df.iloc[i]))):
            df.iloc[i][j]=r[j][int(x[i][j])]
    return df.infer_objects()

Here is an example:

df_exp = build.full_fact(
    {'lr': [5e-4, 2e-4, 1e-3],
     'iterations': [20000, 40000],
     'n_pairs': [20, 40, 80],
     'level': ["LOW", "HIGH"]
     }
)

Is this repo still maintained?

forgi86 avatar Feb 13 '22 22:02 forgi86