Adapter#

The Base Class#

class network_gym_client.Adapter(config_json)[source]#

The base class for environment data format adapter.

This class is an data format “adapter” between the gymnasium environment and network_gym environment. It transforms the network stats measurements (json) to obs and reward (Spaces). It also transforms the action (Spaces) to a policy (json) that can be applied to the network.

Initialize Adapter.

Parameters:

config_json (json) – the configuration file

Methods#

network_gym_client.Adapter.wandb_log_buffer_append(self, info)#

Add to wandb log buffer, the info will be send to wandb later in the wandb_log() function

Parameters:

info (dict) – information to append to the buffer.

network_gym_client.Adapter.wandb_log(self)#

Send the log information to WanDB.

network_gym_client.Adapter.df_to_dict(self, df, id_name='id')#

Transform datatype from pandas.dataframe to dictionary.

Parameters:
  • df (pandas.dataframe) – a pandas.dataframe object

  • description (string) – a descritption for the data

Returns:

dict – converted data with dictionary format

network_gym_client.Adapter.fill_empty_feature(self, feature, value)#

Fill the missing measurements with a input value

Parameters:
  • feature (pd.DataFrame) – feature from the measurement

  • value (int) – the value to fill the missing measurement

Returns:

list – results after replace missing measurements with value