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

Bug fix/fix entity sampling #39

Merged
merged 2 commits into from
Nov 12, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ public class Settings {
public final static int MAX_STORE_ROWS = 10000;

public final static float DEFAULT_RATIO_SIMILARITY = 0.35f;
public final static float DEFAULT_ENTITY_PROBABILITY = 0.6f;
public final static float DEFAULT_ENTITY_PROBABILITY = 0.45f;
public final static float DEFAULT_CAPILLARITY_THRESHOLD = 0.5f;

public final static String PIVOT_KEY_SUFFIX = "#PIVOT?";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ private List<String> sampleEntities() {
final var N = Math.min(this.getTable().getNumberOfRows(), Settings.DEFAULT_SAMPLE_COUNT);
final var entityVector = Tensor
.zeros(this.getTable().getSheet().getDocument().getModel().getEntityList().size());
float n = 0.0f;
for (int i = 0; i < N; i++) {
final BaseRow row = this.getTable().getRowAt(i);
if (row == null) {
Expand All @@ -92,12 +91,9 @@ private List<String> sampleEntities() {
final BaseCell cell = row.getCellAt(this.getColumnIndex());
if (cell.hasValue() && cell.getSymbol().equals("e")) {
entityVector.iadd(cell.getEntityVector());
n += Settings.DEFAULT_ENTITY_PROBABILITY;
}
}
if (n > 0.0f) {
entityVector.if_lt_then(n, 0.0f, 1.0f);
}
entityVector.if_lt_then(N * Settings.DEFAULT_ENTITY_PROBABILITY, 0.0f, 1.0f);
final var entityList = this.getTable().getSheet().getDocument().getModel().getEntityList();
return IntStream.range(0, entityVector.size).boxed()
.filter(i -> entityVector.data[i] == 1)
Expand Down
Loading