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

Add simple eventbuffer and generate temporal results for #95 #96

Merged
merged 6 commits into from
Mar 11, 2024

Conversation

ccrock4t
Copy link
Collaborator

@ccrock4t ccrock4t commented Mar 5, 2024

I added a simple version of event buffer.

This buffer holds first-order events, sorted by time.

The purpose of this buffer is to generate temporal implication statements, e.g., (A &/ B =/> C) and compound events, e.g., (A &/ B).

The operation for generating temporal statements is exhaustive.

The oldest events are at the lowest index, the newest events are at the highest index. The larger the event's timestamp, the newer it is.

@ccrock4t ccrock4t requested review from maxeeem and bowen-xu and removed request for maxeeem March 5, 2024 21:34
@ccrock4t ccrock4t self-assigned this Mar 5, 2024
Copy link

github-actions bot commented Mar 5, 2024

dev.txt - DEV BRANCH: FAILED (failures=55, errors=13)
pr.txt - PR BRANCH: FAILED (failures=55, errors=12)

--- dev.txt	2024-03-10 03:01:24.410362525 +0000
+++ pr.txt	2024-03-10 03:01:24.414362518 +0000
@@ -93,7 +93,7 @@
 test_uni_decomposition_3 (test_NAL3.TEST_NAL3)
 'What differs boys from gials are being strong. ... FAIL
 test_structural_transformation_0 (test_NAL4.TEST_NAL4)
-'Structural transformation ... FAIL
+'Structural transformation ... ok
 test_structural_transformation_1 (test_NAL4.TEST_NAL4)
 'Structural transformation ... ok
 test_structural_transformation_10 (test_NAL4.TEST_NAL4)
@@ -140,7 +140,7 @@
 test_conditional_deduction_0 (test_NAL5.TEST_NAL5)
 'Detachment ... ok
 test_conditional_deduction_compound_eliminate_0 (test_NAL5.TEST_NAL5)
-'conditional deduction ... FAIL
+'conditional deduction ... ok
 test_conditional_deduction_compound_eliminate_1 (test_NAL5.TEST_NAL5)
 'conditional deduction ... ok
 test_conditional_deduction_compound_replace_0 (test_NAL5.TEST_NAL5)
@@ -226,7 +226,7 @@
 test_multiple_variables_introduction_0 (test_NAL6.TEST_NAL6)
 'Multiple variables introduction ... FAIL
 test_multiple_variables_introduction_1 (test_NAL6.TEST_NAL6)
-'Multiple variables introduction ... FAIL
+'Multiple variables introduction ... ok
 test_nlp1 (test_NAL6.TEST_NAL6)
 <(\,REPRESENT,_,CAT) --> cat>. %1.00;0.90% ... ok
 test_nlp2 (test_NAL6.TEST_NAL6)
@@ -260,11 +260,11 @@
 test_unification_4 (test_NAL6.TEST_NAL6)
 'Variable unification ... ok
 test_unification_5 (test_NAL6.TEST_NAL6)
-'Variable unification ... ERROR
+'Variable unification ... ok
 test_unification_5_1 (test_NAL6.TEST_NAL6)
 'Variable unification ... ok
 test_unification_6 (test_NAL6.TEST_NAL6)
-'Variable unification ... ok
+'Variable unification ... FAIL
 test_unification_a1 (test_NAL6.TEST_NAL6)
 'Variable unification ... FAIL
 test_variable_elimination_deduction (test_NAL6.TEST_NAL6)
@@ -315,7 +315,7 @@
 test_inference_on_tense_1 (test_NAL7.TEST_NAL7)
 ' inference on tense ... FAIL
 test_inference_on_tense_2 (test_NAL7.TEST_NAL7)
-' inference on tense ... ok
+' inference on tense ... FAIL
 test_analogy_0_0__0 (test_NAL7.TEST_NAL7_ANALOGY) ... ok
 test_analogy_0_0__1 (test_NAL7.TEST_NAL7_ANALOGY) ... ok
 test_analogy_0_0__2 (test_NAL7.TEST_NAL7_ANALOGY) ... ok
@@ -353,7 +353,7 @@
 test_1_13_var (test_NAL8.TEST_NAL8)
 nal8.1.13.nal ... ERROR
 test_1_14 (test_NAL8.TEST_NAL8)
-nal8.1.14.nal ... ok
+nal8.1.14.nal ... FAIL
 test_1_16 (test_NAL8.TEST_NAL8)
 nal8.1.16.nal ... FAIL
 test_1_2 (test_NAL8.TEST_NAL8)

@ccrock4t ccrock4t linked an issue Mar 5, 2024 that may be closed by this pull request
Copy link
Collaborator

@maxeeem maxeeem left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As you mention in the comments, this will not scale but if the intention is to have some implementation for now and rewrite it later to use Bags then this would be ok.

I'm also not sure about n^3 because if we want to compose 4-component implication such as (&/,A,B,C) =/> D wouldn't this result in n^4 and so on for longer sequences, exploding exponentially?

@ccrock4t
Copy link
Collaborator Author

ccrock4t commented Mar 8, 2024

If we want to compose 4-component implication such as (&/,A,B,C) =/> D wouldn't this result in n^4 and so on for longer sequences?
@maxeeem

Yep, I agree if we are exhaustively creating all compounds, the time complexity will depend how many components we want to piece together at a time (i.e., how many nested For loops). For now since we only want the most simple version, we will only do the 3 components, which includes the precondition $A$, operation $B$, and postcondition $C$.

To include more components in the compounds, such a 4-component implications, we could explicitly create them (which, as you mentioned would worsen the time complexity). Alternatively, we could try to let NAL implicitly handle them by simplifying expressions. For example, we can consider letting compound events like (&/,A,B) into the EventBuffer. Then the event would fit into a "3-component" implication (&/,(&/,A,B),C =/> D), which simplifies to the 4-component implication (&/,A,B,C =/> D)

@bowen-xu
Copy link
Collaborator

bowen-xu commented Mar 8, 2024

@ccrock4t Good work!
Do you have test-case(s) on the event-buffer?

@ccrock4t
Copy link
Collaborator Author

ccrock4t commented Mar 8, 2024

Sure, I can add them

@ccrock4t
Copy link
Collaborator Author

@bowen-xu Some tests are added now, in a new Buffer Test file

@bowen-xu bowen-xu merged commit 52ed0fa into dev Mar 11, 2024
1 check passed
@ccrock4t ccrock4t deleted the SimpleEventBuffer branch March 11, 2024 22:09
@ccrock4t
Copy link
Collaborator Author

ccrock4t commented Mar 15, 2024

The flow is like this:

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature] Simple EventBuffer
3 participants