mindsdb / mindsdb

The platform for building AI from enterprise data
https://mindsdb.com
Other
26.23k stars 4.8k forks source link

[BUG] Format the Mongo ensemble response #2727

Closed ZoranPandovski closed 11 months ago

ZoranPandovski commented 2 years ago

We need to format better the response returned from the:

db.<model_name>.stats({'scale':'ensemble'})

Currently, we return:

{
    "data": [{
        "ensemble": "{\n  \"encoders\": {\n    \"rental_price\": {\n      \"module\": \"NumericEncoder\",\n      \"args\": {\n        \"is_target\": \"True\",\n        \"positive_domain\": \"$statistical_analysis.positive_domain\"\n      }\n    },\n    \"number_of_rooms\": {\n      \"module\": \"OneHotEncoder\",\n      \"args\": {}\n    },\n    \"number_of_bathrooms\": {\n      \"module\": \"BinaryEncoder\",\n      \"args\": {}\n    },\n    \"sqft\": {\n      \"module\": \"NumericEncoder\",\n      \"args\": {}\n    },\n    \"location\": {\n      \"module\": \"OneHotEncoder\",\n      \"args\": {}\n    },\n    \"days_on_market\": {\n      \"module\": \"NumericEncoder\",\n      \"args\": {}\n    },\n    \"initial_price\": {\n      \"module\": \"NumericEncoder\",\n      \"args\": {}\n    },\n    \"neighborhood\": {\n      \"module\": \"OneHotEncoder\",\n      \"args\": {}\n    }\n  },\n  \"dtype_dict\": {\n    \"number_of_rooms\": \"categorical\",\n    \"number_of_bathrooms\": \"binary\",\n    \"sqft\": \"float\",\n    \"location\": \"categorical\",\n    \"days_on_market\": \"integer\",\n    \"initial_price\": \"integer\",\n    \"neighborhood\": \"categorical\",\n    \"rental_price\": \"float\"\n  },\n  \"dependency_dict\": {},\n  \"model\": {\n    \"module\": \"BestOf\",\n    \"args\": {\n      \"submodels\": [\n        {\n          \"module\": \"Neural\",\n          \"args\": {\n            \"fit_on_dev\": true,\n            \"stop_after\": \"$problem_definition.seconds_per_mixer\",\n            \"search_hyperparameters\": true\n          }\n        },\n        {\n          \"module\": \"LightGBM\",\n          \"args\": {\n            \"stop_after\": \"$problem_definition.seconds_per_mixer\",\n            \"fit_on_dev\": true\n          }\n        },\n        {\n          \"module\": \"Regression\",\n          \"args\": {\n            \"stop_after\": \"$problem_definition.seconds_per_mixer\"\n          }\n        }\n      ],\n      \"args\": \"$pred_args\",\n      \"accuracy_functions\": \"$accuracy_functions\",\n      \"ts_analysis\": null\n    }\n  },\n  \"problem_definition\": {\n    \"target\": \"rental_price\",\n    \"pct_invalid\": 2,\n    \"unbias_target\": true,\n    \"seconds_per_mixer\": 57024.0,\n    \"seconds_per_encoder\": null,\n    \"expected_additional_time\": 34.671504497528076,\n    \"time_aim\": 259200,\n    \"target_weights\": null,\n    \"positive_domain\": false,\n    \"timeseries_settings\": {\n      \"is_timeseries\": false,\n      \"order_by\": null,\n      \"window\": null,\n      \"group_by\": null,\n      \"use_previous_target\": true,\n      \"horizon\": null,\n      \"historical_columns\": null,\n      \"target_type\": \"\",\n      \"allow_incomplete_history\": true,\n      \"eval_cold_start\": true,\n      \"interval_periods\": []\n    },\n    \"anomaly_detection\": false,\n    \"use_default_analysis\": true,\n    \"ignore_features\": [],\n    \"fit_on_all\": true,\n    \"strict_mode\": true,\n    \"seed_nr\": 1\n  },\n  \"identifiers\": {\n    \"_id\": \"UUID\"\n  },\n  \"imputers\": [],\n  \"accuracy_functions\": [\n    \"r2_score\"\n  ]\n}"
    }],
    "ns": "mindsdb.home_rentals_model"
}
sikaili99 commented 2 years ago

Hey @ZoranPandovski @Ricram2, I am looking for my first open source contribution, can I take this one? I've seen it has been open for some weeks now. Thanks

ZoranPandovski commented 2 years ago

Sure