@@ -217,7 +217,7 @@ def features(self, subset: List[str] = []) -> Dict[str, Any]:
217217
218218 Parameters
219219 ----------
220- subset : list
220+ subset : list[str]
221221 The subset of features that will be returned.
222222
223223 Returns
@@ -245,14 +245,44 @@ def features(self, subset: List[str] = []) -> Dict[str, Any]:
245245 def feature (self , name : str ) -> Any :
246246 """
247247 Returns a feature of the record.
248+
249+ Parameters
250+ ----------
251+ name : str
252+ The name of the feature that will be returned.
253+
254+ Returns
255+ -------
256+ any
257+ feature.
258+
259+ Examples
260+ --------
261+ >>> example = Record("example", data=dict(features=dict(dead="beef")))
262+ >>> print(example.feature("dead"))
263+ beef
248264 """
249265 if name not in self .data .features :
250266 raise NoSuchFeature (name )
251267 return self .data .features [name ]
252268
253269 def predicted (self , target : str , value : Any , confidence : float ):
254270 """
255- Set the prediction for this record
271+ Set the prediction for this record.
272+
273+ Parameters
274+ ----------
275+ target : str
276+ The target you want to store the prediction at.
277+ value : Any
278+ The prediction.
279+
280+ Examples
281+ --------
282+ >>> example = Record("example", data=dict(features=dict(dead="beef")))
283+ >>> example.predicted("target_name", "feed", 1.00)
284+ >>> print(example.prediction("target_name"))
285+ {'confidence': 1.0, 'value': 'feed'}
256286 """
257287 self .data .prediction [target ] = RecordPrediction (
258288 value = value , confidence = float (confidence )
@@ -261,11 +291,49 @@ def predicted(self, target: str, value: Any, confidence: float):
261291
262292 def prediction (self , target : str ) -> RecordPrediction :
263293 """
264- Get the prediction for this record
294+ Get the prediction for this record.
295+
296+ Parameters
297+ ----------
298+ target : str
299+ The name of the feature that will be returned.
300+
301+ Returns
302+ -------
303+ RecordPrediction
304+ The prediction of the target specified.
305+
306+ Examples
307+ --------
308+ >>> example = Record("example", data=dict(features=dict(dead="beef")))
309+ >>> example.predicted("target_name", "feed", 1.00)
310+ >>> print(example.prediction("target_name"))
311+ {'confidence': 1.0, 'value': 'feed'}
265312 """
266313 return self .data .prediction [target ]
267314
268315 def predictions (self , subset : List [str ] = []) -> Dict [str , Any ]:
316+ """
317+ Get the predictions for the subset of record.
318+
319+ Parameters
320+ ----------
321+ subset : list[str]
322+ The list of subset of the record that predictions are returned for.
323+
324+ Returns
325+ -------
326+ dict
327+ The prediction of the specified subset.
328+
329+ Examples
330+ --------
331+ >>> example = Record("example", data=dict(features=dict(dead="beef")))
332+ >>> example.predicted("target_name1", "feed", 1.00)
333+ >>> example.predicted("target_name2", "deed", 0.97)
334+ >>> print(example.predictions(["target_name1", "target_name2"]))
335+ {'target_name1': {'confidence': 1.0, 'value': 'feed'}, 'target_name2': {'confidence': 0.97, 'value': 'deed'}}
336+ """
269337 if not subset :
270338 return self .data .prediction
271339 for name in subset :
0 commit comments