Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
Prolog mlpack Library
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
general
stups
Prolog mlpack Library
Commits
eb5eb026
Commit
eb5eb026
authored
Oct 11, 2022
by
Jakhes
Browse files
Options
Downloads
Patches
Plain Diff
Update the test template
parent
8d88700a
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/methods/new_method/new_method_test.pl
+31
-48
31 additions, 48 deletions
src/methods/new_method/new_method_test.pl
with
31 additions
and
48 deletions
src/methods/new_method/new_method_test.pl
+
31
−
48
View file @
eb5eb026
:-
use_module
(
library
(
plunit
)).
:-
use_module
(
new_method
).
...
...
@@ -6,51 +7,33 @@
reset_Model
:-
initModel
(
1
,
0
,
50
,
0.0001
).
:-
begin_tests
(
lists
).
%% alpha tests
test
(
alpha_std_init
)
:-
reset_Model
,
alpha
(
0
).
test
(
alpha_wrong_input
,
fail
)
:-
reset_Model
,
alpha
(
1
).
test
(
alpha_after_train
,
A
=:=
9223372036854775808
)
:-
reset_Model
,
convert_list_to_float_array
([
5.1
,
3.5
,
1.4
,
4.9
,
3.0
,
1.4
,
4.7
,
3.2
,
1.3
,
4.6
,
3.1
,
1.5
],
3
,
array
(
Xsize
,
Xrownum
,
X
)),
convert_list_to_float_array
([
0.2
,
0.2
,
0.2
,
0.2
],
array
(
Ysize
,
Y
)),
train
(
X
,
Xsize
,
Xrownum
,
Y
,
Ysize
),
alpha
(
A
).
%% train tests
test
(
correct_train
)
:-
reset_Model
,
convert_list_to_float_array
([
5.1
,
3.5
,
1.4
,
4.9
,
3.0
,
1.4
,
4.7
,
3.2
,
1.3
,
4.6
,
3.1
,
1.5
],
3
,
array
(
Xsize
,
Xrownum
,
X
)),
convert_list_to_float_array
([
0.2
,
0.2
,
0.2
,
0.2
],
array
(
Ysize
,
Y
)),
train
(
X
,
Xsize
,
Xrownum
,
Y
,
Ysize
).
test
(
false_train
,
fail
)
:-
reset_Model
,
convert_list_to_float_array
([],
3
,
array
(
Xsize
,
Xrownum
,
X
)),
convert_list_to_float_array
([
0.2
,
0.2
,
0.2
,
0.2
],
array
(
Ysize
,
Y
)),
train
(
X
,
Xsize
,
Xrownum
,
Y
,
Ysize
).
test
(
false_train2
,
fail
)
:-
reset_Model
,
convert_list_to_float_array
([],
0
,
array
(
Xsize
,
Xrownum
,
X
)),
convert_list_to_float_array
([
0.2
,
0.2
,
0.2
,
0.2
],
array
(
Ysize
,
Y
)),
train
(
X
,
Xsize
,
Xrownum
,
Y
,
Ysize
).
test
(
false_train3
,
fail
)
:-
reset_Model
,
convert_list_to_float_array
([
1
,
2
],
0
,
array
(
Xsize
,
Xrownum
,
X
)),
convert_list_to_float_array
([
0.2
,
0.2
,
0.2
,
0.2
],
array
(
Ysize
,
Y
)),
train
(
X
,
Xsize
,
Xrownum
,
Y
,
Ysize
).
test
(
false_train3
,
fail
)
:-
reset_Model
,
convert_list_to_float_array
([
1
,
2
,
44
,
3
],
3
,
array
(
Xsize
,
Xrownum
,
X
)),
convert_list_to_float_array
([
0.2
,
0.2
,
0.2
,
0.2
],
array
(
Ysize
,
Y
)),
train
(
X
,
Xsize
,
Xrownum
,
Y
,
Ysize
).
test
(
false_train4
)
:-
reset_Model
,
convert_list_to_float_array
([
1
,
2
,
44
,
3
],
2
,
array
(
Xsize
,
Xrownum
,
X
)),
convert_list_to_float_array
([
0.2
,
0.2
,
0.2
,
0.2
],
array
(
Ysize
,
Y
)),
train
(
X
,
Xsize
,
Xrownum
,
Y
,
Ysize
).
:-
end_tests
(
lists
).
\ No newline at end of file
%%
%% TESTING predicate predicate/10
%%
:-
begin_tests
(
predicate
).
%% Failure Tests
test
(
testDescription
,
[
error
(
domain_error
(
'expectation'
,
culprit
),
_
)])
:-
reset_Model_No_Train
(
perceptron
),
train
([
5.1
,
3.5
,
1.4
,
4.9
,
3.0
,
1.4
,
4.7
,
3.2
,
1.3
,
4.6
,
3.1
,
1.5
],
3
,
[
0
,
0
,
0
,
0
],
2
,
culprit
,
50
,
0.0001
,
_
).
test
(
testDescription2
,
[
error
(
_
,
system_error
(
'The values of the Label have to start at 0 and be >= 0 and < the given numClass!'
))])
:-
reset_Model_No_Train
(
perceptron
),
train
([
5.1
,
3.5
,
1.4
,
4.9
,
3.0
,
1.4
,
4.7
,
3.2
,
1.3
,
4.6
,
3.1
,
1.5
],
3
,
[
0
,
1
,
0
,
2
],
2
,
perceptron
,
50
,
0.0001
,
_
).
%% Successful Tests
test
(
testDescription3
,
[
true
(
Error
=:=
1
)])
:-
reset_Model_No_Train
(
perceptron
),
train
([
5.1
,
3.5
,
1.4
,
4.9
,
3.0
,
1.4
,
4.7
,
3.2
,
1.3
,
4.6
,
3.1
,
1.5
],
3
,
[
0
,
0
,
0
,
0
],
2
,
perceptron
,
50
,
0.0001
,
Error
).
test
(
testDescription4
,
[
true
(
Error
=:=
0.9797958971132711
)])
:-
reset_Model_No_Train
(
perceptron
),
open
(
'/home/afkjakhes/eclipse-workspace/prolog-mlpack-libary/src/data_csv/iris2.csv'
,
read
,
File
),
take_csv_row
(
File
,
skipFirstRow
,
10
,
Records
),
train
(
Records
,
4
,
[
0
,
1
,
0
,
1
,
1
,
0
,
1
,
1
,
1
,
0
],
2
,
perceptron
,
50
,
0.0001
,
Error
).
:-
end_tests
(
predicate
).
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment