Edytuj

Udostępnij za pośrednictwem


IMLFeatureProvider Interface

Definition

An interface that defines input or output features and allows access to their values.

[Foundation.Protocol(Name="MLFeatureProvider", WrapperType=typeof(CoreML.MLFeatureProviderWrapper))]
[ObjCRuntime.Introduced(ObjCRuntime.PlatformName.WatchOS, 4, 0, ObjCRuntime.PlatformArchitecture.All, null)]
[ObjCRuntime.Introduced(ObjCRuntime.PlatformName.TvOS, 11, 0, ObjCRuntime.PlatformArchitecture.All, null)]
[ObjCRuntime.Introduced(ObjCRuntime.PlatformName.MacOSX, 10, 13, ObjCRuntime.PlatformArchitecture.Arch64, null)]
[ObjCRuntime.Introduced(ObjCRuntime.PlatformName.iOS, 11, 0, ObjCRuntime.PlatformArchitecture.All, null)]
public interface IMLFeatureProvider : IDisposable, ObjCRuntime.INativeObject
type IMLFeatureProvider = interface
    interface INativeObject
    interface IDisposable
Derived
Attributes
Implements

Remarks

CoreML does not directly read and write system-native data. Rather it uses this class to map strings to values for the inputs and outputs of the MLModel object.

The following example shows a T:Monotouch.CoreML.IMLFeatureProvider that provides 3 inputs variables, all of type double:

public class MarsHabitatPricerInput : NSObject, IMLFeatureProvider
{
	public double SolarPanels { get; set; }
	public double Greenhouses { get; set; }
	public double Size { get; set; }

	public NSSet<NSString> FeatureNames => new NSSet<NSString>(new NSString("solarPanels"), new NSString("greenhouses"), new NSString("size"));

	public MLFeatureValue GetFeatureValue(string featureName)
	{
		switch (featureName)
		{
			case "solarPanels":
				return MLFeatureValue.Create(SolarPanels);
			case "greenhouses":
				return MLFeatureValue.Create(Greenhouses);
			case "size":
				return MLFeatureValue.Create(Size);
			default:
				return MLFeatureValue.Create(0);
		}
	}
}

Properties

FeatureNames

The names of the feature, as defined by the MLModel.

Handle

Handle (pointer) to the unmanaged object representation.

(Inherited from INativeObject)

Methods

GetFeatureValue(String)

Retrieves the value of the .

Applies to