-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from ahmednfwela/pr/memishood/398
improvements to "implement experimental ai-powered search #398"
- Loading branch information
Showing
6 changed files
with
232 additions
and
139 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,31 @@ | ||
class Distribution { | ||
final double mean; | ||
final double sigma; | ||
/// Describes the mean and sigma of distribution of embedding similarity in the embedding space. | ||
/// | ||
/// The intended use is to make the similarity score more comparable to the regular ranking score. | ||
/// This allows to correct effects where results are too "packed" around a certain value. | ||
class DistributionShift { | ||
/// Value where the results are "packed". | ||
/// Similarity scores are translated so that they are packed around 0.5 instead | ||
final double currentMean; | ||
|
||
Distribution({ | ||
required this.mean, | ||
required this.sigma, | ||
/// standard deviation of a similarity score. | ||
/// | ||
/// Set below 0.4 to make the results less packed around the mean, and above 0.4 to make them more packed. | ||
final double currentSigma; | ||
|
||
DistributionShift({ | ||
required this.currentMean, | ||
required this.currentSigma, | ||
}); | ||
|
||
factory Distribution.fromMap(Map<String, Object?> map) { | ||
return Distribution( | ||
mean: map['mean'] as double, | ||
sigma: map['sigma'] as double, | ||
factory DistributionShift.fromMap(Map<String, Object?> map) { | ||
return DistributionShift( | ||
currentMean: map['current_mean'] as double, | ||
currentSigma: map['current_sigma'] as double, | ||
); | ||
} | ||
|
||
Map<String, Object?> toMap() => { | ||
'mean': mean, | ||
'sigma': sigma, | ||
'current_mean': currentMean, | ||
'current_sigma': currentSigma, | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.