From: Damien Mattei <damien.mattei@gmail.com>
To: kawa mailing list <kawa@sourceware.org>
Subject: warning of missing declaration function but code works
Date: Mon, 2 Oct 2023 08:44:06 +0200 [thread overview]
Message-ID: <CADEOadeU3mGEBjpuTY+7R4_ymsJ_7WuunmhVkVUmavn-ne36hg@mail.gmail.com> (raw)
hello,
is there something to do to remove this sort of warnings on code working:
i searched about java declaration, but instead C++ none are required/existing...
bash-3.2$ kawa -f curly-infix2prefix.scm
/Users/mattei/Dropbox/git/AI_Deep_Learning/exo_retropropagationNhidden_layers_matrix_v2-curly+.rkt
curly-infix2prefix.scm:21:21: warning - no declaration seen for
process-input-code-tail-rec
curly-infix2prefix.scm:28:19: warning - no declaration seen for curly-infix-read
curly-infix2prefix.scm:40:21: warning - no declaration seen for curly-infix-read
curly-infix2prefix.scm:110:27: warning - no declaration seen for read-error
curly-infix2prefix.scm:112:12: warning - no declaration seen for consume-to-eol
curly-infix2prefix.scm:114:11: warning - no declaration seen for
my-char-whitespace?
curly-infix2prefix.scm:122:12: warning - no declaration seen for read-error
curly-infix2prefix.scm:131:21: warning - no declaration seen for
consume-whitespace
curly-infix2prefix.scm:134:24: warning - no declaration seen for read-error
curly-infix2prefix.scm:137:24: warning - no declaration seen for read-error
curly-infix2prefix.scm:160:54: warning - no declaration seen for
neoteric-read-real
curly-infix2prefix.scm:166:47: warning - no declaration seen for
neoteric-read-real
curly-infix2prefix.scm:171:47: warning - no declaration seen for
neoteric-read-real
curly-infix2prefix.scm:209:12: warning - no declaration seen for consume-to-eol
curly-infix2prefix.scm:211:11: warning - no declaration seen for
my-char-whitespace?
curly-infix2prefix.scm:223:37: warning - no declaration seen for
neoteric-read-real
curly-infix2prefix.scm:227:12: warning - no declaration seen for read-error
curly-infix2prefix.scm:231:12: warning - no declaration seen for read-error
curly-infix2prefix.scm:235:12: warning - no declaration seen for read-error
curly-infix2prefix.scm:238:12: warning - no declaration seen for
default-scheme-read
curly-infix2prefix.scm:253:11: warning - no declaration seen for ismember?
curly-infix2prefix.scm:253:23: warning - no declaration seen for digits
curly-infix2prefix.scm:254:12: warning - no declaration seen for read-number
curly-infix2prefix.scm:255:26: warning - no declaration seen for process-sharp
curly-infix2prefix.scm:256:26: warning - no declaration seen for process-period
curly-infix2prefix.scm:259:16: warning - no declaration seen for ismember?
curly-infix2prefix.scm:259:43: warning - no declaration seen for digits
curly-infix2prefix.scm:260:14: warning - no declaration seen for read-number
curly-infix2prefix.scm:261:30: warning - no declaration seen for fold-case-maybe
curly-infix2prefix.scm:263:18: warning - no declaration seen for
read-until-delim
curly-infix2prefix.scm:263:40: warning - no declaration seen for
neoteric-delimiters
curly-infix2prefix.scm:265:28: warning - no declaration seen for fold-case-maybe
curly-infix2prefix.scm:267:16: warning - no declaration seen for
read-until-delim
curly-infix2prefix.scm: note - skipped 0 errors, 1 warnings, 0 notes
curly-infix2prefix.scm:438:23: warning - no declaration seen for process-char
The command-line was:
"/opt/homebrew/Cellar/kawa/3.1.1_1/libexec/bin/kawa -f
curly-infix2prefix.scm"
"/Users/mattei/Dropbox/git/AI_Deep_Learning/exo_retropropagationNhidden_layers_matrix_v2-curly+.rkt"
((provide (all-defined-out)) (require srfi/42) (require matrix.rkt)
(include ../Scheme-PLUS-for-Racket/main/Scheme-PLUS-for-Racket/Scheme+.rkt)
(require ../Scheme-PLUS-for-Racket/main/Scheme-PLUS-for-Racket/overload.rkt)
(include ../Scheme-PLUS-for-Racket/main/Scheme-PLUS-for-Racket/assignment.rkt)
(include
../Scheme-PLUS-for-Racket/main/Scheme-PLUS-for-Racket/apply-square-brackets.rkt)
(define-overload-existing-operator +) (define-overload-existing-operator *)
(define-overload-procedure uniform)
(include
../Scheme-PLUS-for-Racket/main/Scheme-PLUS-for-Racket/scheme-infix.rkt)
(overload-existing-operator + vector-append (vector? vector?))
(overload-existing-operator * multiply-flomat-vector (flomat? vector?))
(define (uniform-dummy dummy) (* (random) (if (= (random 2) 0) 1 -1)))
(define (uniform-interval inf sup) (<+ gap (- sup inf))
($nfx$ inf + gap * (random)))
(overload-procedure uniform uniform-dummy (number?))
(overload-procedure uniform uniform-interval (number? number?))
(define (σ z̃) (/ 1 (+ 1 (exp (- z̃)))))
(define (der_tanh z z̃) ($nfx$ 1 - z ** 2))
(define (der_σ z z̃) (* z (- 1 z)))
(define (der_atan z z̃) (/ 1 ($nfx$ 1 + z̃ ** 2)))
(define-syntax reversed
(syntax-rules ()
((_ (name end))
(begin
(unless (equal? (quote in-range) (quote name))
(error first argument is not in-range: (quote name)))
(in-range (- end 1) -1 -1)))
((_ (name start end))
(begin
(unless (equal? (quote in-range) (quote name))
(error first argument is not in-range: (quote name)))
(in-range (- end 1) (- start 1) -1)))))
(define ReseauRetroPropagation
(class object% (super-new)
(init-field (nc #(2 3 1)) (nbiter 10000) (ηₛ 1.0)
(activation_function_hidden_layer tanh)
(activation_function_output_layer tanh)
(activation_function_hidden_layer_derivative der_tanh)
(activation_function_output_layer_derivative der_tanh))
(<+ lnc (vector-length nc))
(field (z (vector-ec (:vector lg nc) (make-vector lg 0)))) (display z=)
(display z) (newline)
(field (z̃ (vector-ec (:vector lg nc) (make-vector lg 0)))) (display z̃=)
(display z̃) (newline) (define-pointwise-unary uniform)
(<+ M
(vector-ec (: n (- lnc 1))
(.uniform!
(zeros ($bracket-apply$ nc n + 1) (+ ($bracket-apply$ nc n) 1)))))
(display M=) (display M) (newline)
(field (ᐁ (for/vector ((lg nc)) (make-vector lg 0)))) (display ᐁ=)
(display ᐁ) (newline) (display nbiter=) (display nbiter) (newline)
(field (error 0))
(define (accepte_et_propage x)
(when (≠ (vector-length x) (vector-length ($bracket-apply$ z 0)))
(display Mauvais nombre d'entrées !) (newline) (exit #f))
(<- ($bracket-apply$ z 0) x) (<+ n (vector-length z)) (declare z_1)
(declare i)
(for ((<- i 0) ($nfx$ i < n - 2) ($nfx$ i <- i + 1))
($nfx$ z_1 <- #(1) + ($bracket-apply$ z i))
($nfx$ ($bracket-apply$ z̃ i + 1) <- ($bracket-apply$ M i) * z_1)
(<- ($bracket-apply$ z i + 1)
(vector-map activation_function_hidden_layer
($bracket-apply$ z̃ i + 1))))
($nfx$ z_1 <- #(1) + ($bracket-apply$ z i))
($nfx$ ($bracket-apply$ z̃ i + 1) <- ($bracket-apply$ M i) * z_1)
(<- ($bracket-apply$ z i + 1)
(vector-map activation_function_output_layer ($bracket-apply$ z̃ i + 1))))
(define/public (apprentissage Lexemples) (<+ ip 0) (declare x y)
(for-racket ((it (in-range nbiter)))
(when ($nfx$ it % 100 = 0) (display it) (newline)) (<+ err 0.0)
(<- (x y) ($bracket-apply$ Lexemples ip)) (accepte_et_propage x)
(<+ i i_output_layer (- (vector-length z) 1))
(<+ ns (vector-length ($bracket-apply$ z i)))
(for-racket ((k (in-range ns)))
($nfx$ ($bracket-apply$ ($bracket-apply$ ᐁ i) k) <- ($bracket-apply$ y k)
- ($bracket-apply$ ($bracket-apply$ z i) k))
($nfx$ err <- err + ($bracket-apply$ ($bracket-apply$ ᐁ i) k) ** 2))
($nfx$ err <- err * 0.5) (when ($nfx$ it = nbiter - 1) (<- error err))
(<+ მzⳆმz̃ activation_function_output_layer_derivative)
(modification_des_poids ($bracket-apply$ M i - 1) ηₛ
($bracket-apply$ z i - 1) ($bracket-apply$ z i) ($bracket-apply$ z̃ i)
($bracket-apply$ ᐁ i) მzⳆმz̃)
(<- მzⳆმz̃ activation_function_hidden_layer_derivative)
(for-racket ((i (reversed (in-range 1 i_output_layer))))
(<+ nc (vector-length ($bracket-apply$ z i)))
(<+ ns (vector-length ($bracket-apply$ z i + 1)))
(for-racket ((j (in-range nc))) (<+ k 0)
(<- ($bracket-apply$ ($bracket-apply$ ᐁ i) j)
(for/sum ((k (in-range ns)))
(*
(მzⳆმz̃ ($bracket-apply$ ($bracket-apply$ z i + 1) k)
($bracket-apply$ ($bracket-apply$ z̃ i + 1) k))
($bracket-apply$ ($bracket-apply$ M i) k (+ j 1))
($bracket-apply$ ($bracket-apply$ ᐁ i + 1) k)))))
(modification_des_poids ($bracket-apply$ M i - 1) ηₛ
($bracket-apply$ z i - 1) ($bracket-apply$ z i) ($bracket-apply$ z̃ i)
($bracket-apply$ ᐁ i) მzⳆმz̃))
(<- ip (random (vector-length Lexemples)))))
(define
(modification_des_poids M_i_o η z_input z_output z̃_output ᐁ_i_o მzⳆმz̃)
(<+ (len_layer_output len_layer_input_plus1forBias) (dim M_i_o))
(<+ len_layer_input (- len_layer_input_plus1forBias 1))
(for-racket ((j (in-range len_layer_output)))
(for-racket ((i (in-range len_layer_input)))
($nfx$ ($bracket-apply$ M_i_o j (+ i 1)) <-
($bracket-apply$ M_i_o j (+ i 1)) -
(* (- η) ($bracket-apply$ z_input i)
(მzⳆმz̃ ($bracket-apply$ z_output j) ($bracket-apply$ z̃_output j))
($bracket-apply$ ᐁ_i_o j))))
($nfx$ ($bracket-apply$ M_i_o j 0) <- ($bracket-apply$ M_i_o j 0) -
(* (- η) 1.0
(მzⳆმz̃ ($bracket-apply$ z_output j) ($bracket-apply$ z̃_output j))
($bracket-apply$ ᐁ_i_o j)))))
(define/public (test Lexemples) (display Test des exemples :) (newline)
(<+ err 0) (declare entree sortie_attendue ᐁ)
(for-racket ((entree-sortie_attendue Lexemples))
(<- (entree sortie_attendue) entree-sortie_attendue)
(accepte_et_propage entree)
(printf ~a --> ~a : on attendait ~a entree
($bracket-apply$ z (vector-length z) - 1) sortie_attendue)
(newline)
($nfx$ ᐁ <- ($bracket-apply$ sortie_attendue 0) -
($bracket-apply$ ($bracket-apply$ z (vector-length z) - 1) 0))
($nfx$ error <- error + ᐁ ** 2))
($nfx$ err <- err * 0.5) (display Error on examples=) (display error)
(newline))))
(printf ################## NOT ##################) (newline)
(<+ r1
(new ReseauRetroPropagation (nc #(1 2 1)) (nbiter 50000) (ηₛ 10)
(activation_function_hidden_layer σ) (activation_function_output_layer σ)
(activation_function_hidden_layer_derivative der_σ)
(activation_function_output_layer_derivative der_σ)))
(<+ Lexemples1 #((#(1) . #(0)) (#(0) . #(1))))
(send r1 apprentissage Lexemples1) (send r1 test Lexemples1) (newline)
(printf ################## XOR ##################) (newline)
(<+ r2
(new ReseauRetroPropagation (nc #(2 3 1)) (nbiter 250000) (ηₛ 10)
(activation_function_hidden_layer σ) (activation_function_output_layer σ)
(activation_function_hidden_layer_derivative der_σ)
(activation_function_output_layer_derivative der_σ)))
(<+ Lexemples2
#((#(1 0) . #(1)) (#(0 0) . #(0)) (#(0 1) . #(1)) (#(1 1) . #(0))))
(send r2 apprentissage Lexemples2) (send r2 test Lexemples2)
(printf ################## SINUS ##################) (newline)
(<+ r3
(new ReseauRetroPropagation (nc #(1 70 70 1)) (nbiter 50000) (ηₛ 0.01)
(activation_function_hidden_layer atan)
(activation_function_output_layer tanh)
(activation_function_hidden_layer_derivative der_atan)
(activation_function_output_layer_derivative der_tanh)))
(<+ Llearning
(vector-ec (:list x (list-ec (: n 10000) (uniform (- pi) pi)))
(cons (vector x) (vector (sin x)))))
(<+ Ltest
(vector-ec (:list x (list-ec (: n 10) (uniform (/ (- pi) 2) (/ pi 2))))
(cons (vector x) (vector (sin x)))))
(send r3 apprentissage Llearning) (send r3 test Ltest))
next reply other threads:[~2023-10-02 6:44 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-02 6:44 Damien Mattei [this message]
2023-10-02 8:38 ` Per Bothner
2023-10-02 8:56 ` Damien Mattei
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CADEOadeU3mGEBjpuTY+7R4_ymsJ_7WuunmhVkVUmavn-ne36hg@mail.gmail.com \
--to=damien.mattei@gmail.com \
--cc=kawa@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).