%% Train Hash Similarity Model Using Tabular Data
% Load training data.

load('hashTrainTables.mat')

% The training data is a cell array of tables. Each table is a degradation feature profile for a component. Each profile consists of life time measurements in the "Time" variable and corresponding degradation feature measurements in the "Condition" variable.
%
% Create a hash similarity model that uses the following values as hashed features:

mdl = hashSimilarityModel('Method',@(x) [mean(x),std(x),kurtosis(x),median(x)]);

%
% Train the similarity model using the training data. Specify the names of the life time and data variables.

fit(mdl,hashTrainTables,"Time","Condition")

% Copyright 2012 The MathWorks, Inc.