{"version":"1.0","type":"rich","title":"One hot encode function (for model-building, keras, etc)","description":"This example demonstrates a one-hot encoding function that converts an array of categorical object labels into a binary matrix format suitable for training neural networks in Keras. The code defines `one_hot_encode_object_array`, which uses NumPy’s `np.unique` with `return_inverse=True` to map each unique string to an integer ID, then passes those IDs to `np_utils.to_categorical` from Keras to produce the final encoded vectors. It applies this transformation separately to training and testing label arrays (`train_y` and `test_y`), storing the results as `train_y_ohe` and `test_y_ohe` for subsequent model building.","provider_name":"VizHub AI Studio","provider_url":"https://next.vizhub.com","html":"<iframe src=\"https://next.vizhub.com/viz/gist-3fbd3b3e2957c8c9d8d9c88aaedd1f16?mode=embed\" width=\"960\" height=\"500\" scrolling=\"no\" frameborder=\"1\"></iframe>","width":960,"height":500,"cache_age":3600}