transparentai.sustainable

This submodule contains functions in the transparentai.sustainable submodule.

Sustainable submodule

transparentai.sustainable.energy_usage.evaluate_kWh(func, *args, verbose=False)[source]

Using energyusage.evaluate function returns the result of the function and the effective emissions of the function (in kWh)

With verbose = True you can see the report with details.

If you want a pdf please use the following:

>>> energyusage.evaluate(func, *args, pdf=True)

From energyusage package.

Parameters:
  • func – User’s function
  • verbose (bool (default False)) – Whether it shows details or not
Returns:

  • float – effective emissions of the function in kWh
  • any – function’s return

transparentai.sustainable.sustainable.emissions(process_kwh, breakdown, location)[source]

Calculates the CO2 emitted by the program based on the location

Parameters:
  • process_kwh (int) – kWhs used by the process
  • breakdown (list) – energy mix corresponding to user’s location
  • location (str) – location of user
Returns:

emission in kilograms of CO2 emitted

Return type:

float

Raises:

ValueError: – Process wattage must be greater than 0.

transparentai.sustainable.sustainable.energy_mix(location)[source]

Gets the energy mix information for a specific location

Parameters:
  • location (str) – user’s location
  • location_of_default (str) – Specifies which average to use if location cannot be determined
Returns:

percentages of each energy type

Return type:

list

Raises:

ValueError: – location must be a valid countries

transparentai.sustainable.sustainable.estimate_co2(hours, location, watts=250, powerLoss=0.8)[source]

Returns co2 consumption in kg CO2

To find out the wattage of the machine used for training, I recommend you use this website: Newegg’s Power Supply Calculator .

Based on this website: Power Management Statistics we can estimate an average wattage to be 250 Watts, but be carefull, it’s only an estimation. So if you’re using a computer with GPU or others components I recommend you use the first website that allows you to compute your wattage.

Parameters:
  • hours (int) – time of training in hours
  • location (str) – location of user
  • watts (int (default 250)) – Wattage of the computer or server that was used for training
  • powerLoss (float (default 0.8)) – PSU efficiency rating
Returns:

emission in kilograms of CO2 emitted

Return type:

float

transparentai.sustainable.sustainable.get_energy_data(year=2016)[source]

Loads enery data from a specify year (only 2016 is currently available)

Parameters:year (int (default 2016)) – Year of the energy mix data
Returns:Energy mix per country of the selected year
Return type:dict