Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename current_mean and current_sigma for AI feature #407

Merged
merged 1 commit into from
Jan 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions lib/src/settings/distribution.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,27 @@
class DistributionShift {
/// Value where the results are "packed".
/// Similarity scores are translated so that they are packed around 0.5 instead
final double currentMean;
final double mean;

/// 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;
final double sigma;

DistributionShift({
required this.currentMean,
required this.currentSigma,
required this.mean,
required this.sigma,
});

factory DistributionShift.fromMap(Map<String, Object?> map) {
return DistributionShift(
currentMean: map['current_mean'] as double,
currentSigma: map['current_sigma'] as double,
mean: map['mean'] as double,
sigma: map['sigma'] as double,
);
}

Map<String, Object?> toMap() => {
'current_mean': currentMean,
'current_sigma': currentSigma,
'mean': mean,
'sigma': sigma,
};
}
12 changes: 6 additions & 6 deletions test/search_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -604,8 +604,8 @@ void main() {
binaryQuantized: true,
dimensions: 100,
distribution: DistributionShift(
currentMean: 20,
currentSigma: 5,
mean: 20,
sigma: 5,
),
url: 'https://example.com',
documentTemplateMaxBytes: 200,
Expand All @@ -619,8 +619,8 @@ void main() {
'documentTemplate': 'a book titled {{ doc.title }}',
'dimensions': 100,
'distribution': {
'current_mean': 20,
'current_sigma': 5,
'mean': 20,
'sigma': 5,
},
'url': 'https://example.com',
'documentTemplateMaxBytes': 200,
Expand All @@ -635,8 +635,8 @@ void main() {
expect(
deserialized.documentTemplate, 'a book titled {{ doc.title }}');
expect(deserialized.dimensions, 100);
expect(deserialized.distribution?.currentMean, 20);
expect(deserialized.distribution?.currentSigma, 5);
expect(deserialized.distribution?.mean, 20);
expect(deserialized.distribution?.sigma, 5);
expect(deserialized.url, 'https://example.com');
expect(deserialized.documentTemplateMaxBytes, 200);
expect(deserialized.binaryQuantized, true);
Expand Down
Loading