Skip to content

How to get fitted learner from Object #217

Answered by SvenKlaassen
chungdz asked this question in Q&A
Discussion options

You must be logged in to vote

Thank you.
The learner attribute is just a copy of the unfitted learner (since they have to be used multiple times).
To store the fitted models you have set the store_models argement in the .fit() method. The fitted models are then accessible under the models attribute.

import numpy as np
from doubleml.datasets import fetch_bonus
from sklearn.base import clone
from sklearn.ensemble import RandomForestRegressor
from doubleml import DoubleMLData, DoubleMLPLR

df_bonus = fetch_bonus('DataFrame')
xinputs = ['female', 'black', 'othrace', 'dep1', 'dep2',
        'q2', 'q3', 'q4', 'q5', 'q6', 'agelt35', 'agegt54',
        'durable', 'lusd', 'husd']
dml_data_bonus = DoubleMLData(df_bonus,
       …

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
4 replies
@SvenKlaassen
Comment options

Answer selected by PhilippBach
@kartechbabu
Comment options

@SvenKlaassen
Comment options

@kartechbabu
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants