tirthajyoti / doepy

Design of Experiment Generator. Read the docs at: https://doepy.readthedocs.io/en/latest/
MIT License
143 stars 41 forks source link

Float precision #14

Open jeannotalpin opened 3 years ago

jeannotalpin commented 3 years ago

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?

Thanks.

forgi86 commented 2 years ago

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?