Skip to content

Commit

Permalink
Fixed a bug in chi2 evaluator
Browse files Browse the repository at this point in the history
  • Loading branch information
Remper committed Aug 2, 2016
1 parent 6b98be7 commit ff7d876
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
Binary file modified dist/ml
Binary file not shown.
Binary file removed dist/ml.10.8
Binary file not shown.
13 changes: 6 additions & 7 deletions ml.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@
44119C9F192FBE6100290AEB /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0510;
LastUpgradeCheck = 0730;
ORGANIZATIONNAME = 2Eco;
};
buildConfigurationList = 44119CA2192FBE6100290AEB /* Build configuration list for PBXProject "ml" */;
Expand Down Expand Up @@ -183,6 +183,7 @@
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
Expand All @@ -198,9 +199,9 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.8;
MACOSX_DEPLOYMENT_TARGET = 10.11;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = macosx10.8;
SDKROOT = macosx;
};
name = Debug;
};
Expand Down Expand Up @@ -231,15 +232,14 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.8;
SDKROOT = macosx10.8;
MACOSX_DEPLOYMENT_TARGET = 10.11;
SDKROOT = macosx;
};
name = Release;
};
44119CB6192FBE6100290AEB /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD)";
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "ml/ml-Prefix.pch";
PRODUCT_NAME = "$(TARGET_NAME)";
Expand All @@ -249,7 +249,6 @@
44119CB7192FBE6100290AEB /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD)";
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "ml/ml-Prefix.pch";
PRODUCT_NAME = "$(TARGET_NAME)";
Expand Down
4 changes: 3 additions & 1 deletion ml/ChiSquaredEvaluator.m
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ - (double) calculateFeature:(NSDictionary*)feature withClassTotals:(NSDictionary
double current = [[obj objectForKey:klass] doubleValue];
double featureTotal = [[obj objectForKey:@":total"] doubleValue];
double expected = classTotal * featureTotal / (double) total;
chi += pow(expected - current, 2) / expected;
if (expected != 0) {
chi += pow(expected - current, 2) / expected;
}
}];
}];

Expand Down

0 comments on commit ff7d876

Please sign in to comment.