LC.Predictor
0.2.1
dotnet add package LC.Predictor --version 0.2.1
NuGet\Install-Package LC.Predictor -Version 0.2.1
<PackageReference Include="LC.Predictor" Version="0.2.1" />
paket add LC.Predictor --version 0.2.1
#r "nuget: LC.Predictor, 0.2.1"
// Install LC.Predictor as a Cake Addin #addin nuget:?package=LC.Predictor&version=0.2.1 // Install LC.Predictor as a Cake Tool #tool nuget:?package=LC.Predictor&version=0.2.1
What is LC.Predictor?
LC.Predictor is a .NET Standard 2.0 (C#) interface used in communication between a predictor software backend and a client software frontend. The chemometrics prediction API adds predictor capabilities to the client software using LabCognition or other third party backend software offering prediction capabilities.
The SamplePredictor implementation is demonstrating how to use this API within a third party client frontend software and Labcognition software as predictor backend software.
Previous Versions
0.2.1
- add net8 target
- remove explicit 3rd-party license acknowledgements. This must be handled by extracting the references using a tool.
0.2.0
- add 3rd-party license acknowledgements are deployed with the package
0.1.0
LC.Predictor superseeds parts of LabCognition.Interface (1.2.0). Interfaces and methods used in LabCognition.Interface have been revised and renamed. Here is a matrix depicting the changes:
LabCognition.Interface (1.2.0) | LC.Predictor (0.1.0) | Action |
---|---|---|
IPredicitonEngine | IPredictor | renamed and methods changed |
IPredictionEngineReport | no implemention! | deprecated; use IPredictor methods |
object[,] Predict(double[] dataX, double[] dataY, string[] constituents, string[] properties); | IPredictionResult[]? Predict(double[] dataX, double[] dataY); | use type specific prediction results and changed the result output using IPredicitonResult |
string[] GetProperties(); and string[] GetConstituents(); | IPredictionResult[]? GetResultPreview(); | changed concept by returning an empty preview containing flat PredictionResult<T> objects of the expected results rather than lists of properties and constituents |
What is Prediction?
Prediction means the calculation of a physical property like a concentration value from spectroscopic data using a multivariate calibration model.
Input
The input of such prediction method is a spectrum in the form of x,y data and a calibration model created with LabCognition software.
Output
The output of the prediction method are one or more quantitative and/or qualitative prediction results. Each result may be a numeric or a string value generated by the calibration model algorithm when performing a prediction.
Preparing the Input Data
Create a Calibration Model
At first you must create a calibration model with LabCognition or the modelling software implementing the LC.Predictor. Once created, the calibration model is typically a single file containing the recipe to convert spectroscopic data into the desired prediction result. A detailed description on how to do this is given elsewhere.
Record Sample Spectra
Performing prediction requires suitable spectra taken from physical samples as files in scientific file format or as x,y values in memory.
Additional Calibration Metadata
In case additional metadata shall be calibrated in combination with spectral data, it must be appended to the x,y data of the spectrum in order to transport it through the interface.
Operating the LC.Predictor from the client frontend software
The calibration modelling software or the predictor software used in the backend providing the prediction capabilities must implement the Interfaces IPredictorFactory and IPredictor. This may be the LabCognition or another third party software. In the client frontend software you may implement the counterparts using these two interfaces as follows:
Creating IPredictor Instance
Create an instance of the application using one of the IPredictorFactory.ReadModelFromXXXX interface method. It will create an instance or the predictor software granting communication through IPredictor interface.
Additionally, it loads the desired calibration model into that instance:
- IPredictorFactory.ReadModelFromFile Load a calibration model from a file on hard disc
- IPredictorFactory.ReadModelFromStream Load a calibration model from a stream (which can also be a memory stream)
- IPredictorFactory.ReadModelFromMemory Load a calibration model from a blob in memory
Gathering possible Prediction Results
You might need information upfront on all possible outputs a calibration model will return when running a prediction. The GetResultPreview() method returns a list of all the results you will get when performing a prediction.
Prediction Result
Each result comes with some properties describing the result:
Value The main output you are interested in. In principle two value types are supported:
- numeric (double)
- text (string)
Unit This is an optional text describing the value's unit, if any
Property The result type such as predicted, residual, spectral residual, Mahalanobis disctance, etc. Some results refer to a particular constituent and others refer to general spectral properties.
Constituent The name of the predicted feature e.g. fat, protein, etc. in wheat. For spectral properties this is empty.
Since the value type is not unique for all results they are returned as IPredictionResult. Use the GetValueType() method in the IPredictionResult interface to identify the value type.
Run Prediction
Call the Predict(double[] dataX, double[] dataY) method with your spectrum's x,y data to obtain the prediction results.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- No dependencies.
-
net8.0
- No dependencies.
NuGet packages (1)
Showing the top 1 NuGet packages that depend on LC.Predictor:
Package | Downloads |
---|---|
LC.ReactionMonitoring
Reaction and process monitoring trend results of the LabCognition software suite can be consumed using this interface package |
GitHub repositories
This package is not used by any popular GitHub repositories.
v.0.2.1
- add net8 support
- fix 3rd party license acknowledgements
v.0.2.0
- include 3rd-party license acknowledgements
v.0.1.0
- replaces LabCognition.Interface with new definitions