Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagepy
spec = c3.EvalMetricsSpec({
	'ids':   ids=[ 'AIllinois_UnitedStates', 'BCalifornia_UnitedStates', 'CUnitedStates' ],
	'expressions':   expressions=[ 'SampleMetricJHU_ConfirmedCases', 'SampleMetric2JHU_ConfirmedDeaths' ],
	'  start=': '20192020-01-01',
	'  end=': '2019-052020-08-01',
	'interval':   interval='DAY',
})

results = c3.SampleTypeOutbreakLocation.evalMetrics(spec=spec)

The C3 AI Suite returns the evaluated metric results (a timeseries) into the 'EvalMetricsResult' type. With various helper functions, C3.ai developers may then convert this timeseries into a Pandas DataFrame (via "Dataset" type) for further data analysis or model development in a Jupyter notebook, as shown below.

Code Block
languagepy
ds = c3.Dataset.fromEvalMetricsResult(result=results)
df = c3.Dataset.toPandas(dataset=ds)

Additionally, users can visualize evaluated metric results directly in the web-browser (i.e., JavaScript console) with the 'c3Viz' function.

Here's an example of evaluating and visualizing in JavaScript console.

In Python, you can also specify the spec using a Dictionary without creating an EvalMetricsSpec Type:

Code Block
results = c3.OutbreakLocation.evalMetrics(spec={
	'ids': [ 'Illinois_UnitedStates', 'California_UnitedStates', 'UnitedStates' ],
	'expressions': [ 'JHU_ConfirmedCases', 'JHU_ConfirmedDeaths' ],
	'start': '2020-01-01',
	'end': '2020-08-01',
	'interval': 'DAY',
})


The C3 AI Suite returns the evaluated metric results (a timeseries) into the 'EvalMetricsResult' type. With various helper functions, C3.ai developers may then convert this timeseries into a Pandas DataFrame (via "Dataset" type) for further data analysis or model development in a Jupyter notebook, as shown below.

Code Block
languagepy
ds = c3.Dataset.fromEvalMetricsResult(result=results)
df = c3.Dataset.toPandas(dataset=ds)

Additionally, users can visualize evaluated metric results directly in the web-browser (i.e., JavaScript console) with the 'c3Viz' function.

Here's an example of evaluating and visualizing in JavaScript console.

Code Block
languagejs
var spec = EvalMetricsSpec.make({
	'ids': ['Illinois_UnitedStates', 'California_UnitedStates', 'UnitedStates' ],
	'expressions': [ 'JHU_ConfirmedCases', 'JHU_ConfirmedDeaths' ],
	'start': '2020-01-01',
	'end': '2020-08-01',
	'interval': 'DAY'
})

var results = OutbreakLocation.evalMetrics(spec)
c3Viz(results)

Similarly, we don't have to explicitly create an EvalMetricsSpec type:

Code Block
var results = OutbreakLocation.evalMetrics({
    'ids': ['Illinois_UnitedStates', 'California_UnitedStates', 'UnitedStates' ],
    'expressions': [ 'JHU_ConfirmedCases', 'JHU_ConfirmedDeaths' ],
    'start': '2020-01-01',
    'end': '2020-08-01',
    'interval': 'DAY'
}
Code Block
languagejs
var spec = EvalMetricsSpec(
	ids= ['A', 'B', 'C' ],
	expressions= [ 'SampleMetric', 'SampleMetric2' ],
	start= '2019-01-01',
	end= '2019-05-01',
	interval= 'DAY')

var results = SampleType.evalMetrics(spec)
c3Viz(results)


To learn more about evaluating and visualizing metrics, please see the C3.ai Developer Documentation here:

...