small fixes

This commit is contained in:
Vítor Santos Costa 2018-10-18 22:00:27 +01:00
parent b31493c777
commit b4bd6b4ba8
8 changed files with 16 additions and 24 deletions

View File

@ -623,6 +623,10 @@
BOp(undef_p, e);
/* save S for module name */
if (LOCAL_DoingUndefp) {
PREG=FAILCODE;
JMPNext();
}
LOCAL_DoingUndefp = true;
saveregs();
undef_goal(PASS_REGS1);

View File

@ -977,7 +977,7 @@ PredEntry *YAPPredicate::getPred(Term &t, Term &m, CELL *&out) {
} else {
ap = RepPredProp(PredPropByFunc(f, m));
if (out)
memmove(out, RepAppl(t) + 1, ap->ArityOfPE * sizeof(CELL));
memmove(out, (const CELL *)RepAppl(t) + 1, ap->ArityOfPE * sizeof(CELL));
else
out = RepAppl(t) + 1;
}

View File

@ -525,8 +525,9 @@ public:
mk(t);
}
}
/// type check for unbound
bool unbound() { return IsUnboundVar(VarOfTerm(gt())); }
inline bool isVar() { return true; } /// type check for unbound
inline bool isVar() { return true; }
inline bool isAtom() { return false; } /// type check for atom
inline bool isInteger() { return false; } /// type check for integer
inline bool isFloat() { return false; } /// type check for floating-point

View File

@ -57,7 +57,7 @@
with the `use_module(library(lists))` command.
*/
:- include(pl/bootlists).
%:- include(pl/bootlists).
/** @pred list_concat(+ _Lists_,? _List_)

View File

@ -703,7 +703,7 @@ ground_truth_difference :-
%= -Float
%========================================================================
mse_trainingset_only_for_linesearch(MSE) :-
mse_trainingset_only_for_linesearch(MSE, FX) :-
update_values,
example_count(Example_Count),
@ -712,21 +712,8 @@ mse_trainingset_only_for_linesearch(MSE) :-
forall(user:example(QueryID,_Query,QueryProb,Type),
(
once(update_query(QueryID,'.',probability)),
query_probability(QueryID,CurrentProb),
once(update_query_cleanup(QueryID)),
(
(Type == '='; (Type == '<', CurrentProb>QueryProb); (Type=='>',CurrentProb<QueryProb))
->
(
bb_get(error_train_line_search,Old_Error),
New_Error is Old_Error + (CurrentProb-QueryProb)**2,
bb_put(error_train_line_search,New_Error)
);true
)
)
),
bb_delete(error_train_line_search,Error),
MSE is Error/Example_Count,
),
format_learning(3,' (~8f)~n',[MSE]),
retractall(values_correct).
@ -842,7 +829,7 @@ set_tunable(I,Slope,P) :-
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% start calculate gradient
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
user:evaluate(LLH_Training_Queries, X,Grad,N,_,_) :-
%Handle = user_error,
example_count(TrainingExampleCount),
@ -984,7 +971,7 @@ user:progress(FX,X,_G,X_Norm,G_Norm,Step,_N,Iteration,Ls,0) :-
NextIteration is CurrentIteration+1,
assertz(current_iteration(NextIteration)),
save_model,
set_problog_flag(mse_trainset, FX),
set_problog_flag(mse_trainingset, FX),
X0 <== X[0], sigmoid(X0,Slope,P0),
X1 <== X[1], sigmoid(X1,Slope,P1),
format('~d. Iteration : (x0,x1)=(~4f,~4f) f(X)=~4f |X|=~4f |X\'|=~4f Step=~4f Ls=~4f~n',[Iteration,P0 ,P1,FX,X_Norm,G_Norm,Step,Ls]).

View File

@ -640,7 +640,7 @@ static JNIEnv*
jni_env(void) /* economically gets a JNIEnv pointer, valid for this thread */
{ JNIEnv *env;
switch( (*jvm)->GetEnv(jvm, (void**)&env, JNI_VERSION_1_8) )
switch( (*jvm)->GetEnv(jvm, (void**)&env, JNI_VERSION_1_4) )
{ case JNI_OK:
return env;
case JNI_EDETACHED:
@ -5675,7 +5675,7 @@ static foreign_t
int i;
term_t head;
term_t list;
char *s;
char *s = NULL;
if ( jvm_dia == NULL ) /* presumably, JVM is already started, so default options cannot now be set */
{

View File

@ -166,7 +166,7 @@ listing(Stream, [MV|MVs]) :- !,
->
format( Stream, ':- dynamic ~q/~d.~n', [N,Ar])
;
\ format( Stream, ':- dynamic ~q:~q/~d.~n', [M,N,Ar])
format( Stream, ':- dynamic ~q:~q/~d.~n', [M,N,Ar])
),
fail.
'$list_clauses'(Stream, M, Pred) :-

View File

@ -48,7 +48,7 @@ prolog:'$protect' :-
'$new_system_predicate'(Name,Arity,M),
sub_atom(Name,0,1,_, '$'),
functor(P,Name,Arity),
%'$hide_predicate'(P,M),
'$stash_predicate'(P,M),
fail.
prolog:'$protect' :-
current_atom(Name),