ighdez / choicedesign

Experimental designs for discrete choice models
5 stars 3 forks source link

Added fixed option leads to error using the examples #4

Open PhDH-UKS opened 6 months ago

PhDH-UKS commented 6 months ago

If I use the code from the examples, I automatically run into an error, as the Attributes dictionaries do not contain values for 'fixed'.

If I add 'fixed=None' as a new entry to the dictionaries, the code works, but the first 8 rows of the init_design matrix have the value 0.0 for all attribute values.

Update after trying out some options: The lines that are empty are the number of attributes times the number of alternatives. This means the fix for this problem is the following:


att_alt=num_alternatives*num_attributes

design = EffDesign(
    atts_list=[A,B_1,B_2,C,D],
    alts=Alts,
    ncs=NCS+att_alt
    )

large_init_design = design.gen_initdesign()
print(large_init_design)

init_design= large_init_design.iloc[att_alt:]
print(init_design)

init_design= init_design.reset_index()
init_design.drop(['index'], axis=1, inplace=True)
print(init_design)

design.N = NCS

Afterwards init_design can be used as in the examples

Greetings Philipp