Witam mam problem z uruchomieniem poniższego skryptu, pierwszy błąd pojawia się przy pętli foreach.
Byłbym wdzięczny jeśli ktoś sprawdziłby ten skrypt pod kątem poprawności kodu.
#csh
#---------------------------------------------------------------------
# N-way cross-validation script
#---------------------------------------------------------------------
#
# invocation:
# csh xval.sh filestem N [options for c4.5 and c4.5rules] [suffix]
#
# individual results from each block are left in
# filestem.[rt]o*[suffix],
# averages over all blocks in
# filestem.[rt]res[suffix]
#---------------------------------------------------------------------
# sort the options into result suffix and control options for the programs
# Note: for options with values, there must be no space between the option
# name and value; e.g. "-v1", not "-v 1"
set treeopts =
set ruleopts =
set suffix =
foreach i ( $argv[3-] )
switch ( $i )
case "+*":
set suffix = $i
breaksw
case "-v*":
case "-c*":
set treeopts = ($treeopts $i)
set ruleopts = ($ruleopts $i)
breaksw
case "-p":
case "-t*":
case "-w*":
case "-i*":
case "-g":
case "-s":
case "-m*":
set treeopts = ($treeopts $i)
breaksw
case "-r*":
case "-F*":
case "-a":
set ruleopts = ($ruleopts $i)
breaksw
default:
echo "unrecognised or inappropriate option" $i
exit
endsw
end
# prepare the data for cross-validation
cat $1.data $1.test | xval-prep $2 >XDF.data
cp /dev/null XDF.test
ln $1.names XDF.names
rm $1.[rt]o[0-9]*$suffix
set junk = `wc XDF.data`
set examples = $junk[1]
set large = `expr $examples % $2`
set segsize = `expr \( $examples / $2 \) + 1`
# perform the cross-validation trials
set i = 0
while ( $i < $2 )
if ( $i == $large ) set segsize = `expr $examples / $2`
cat XDF.test XDF.data | split -`expr $examples - $segsize`
mv xaa XDF.data
mv xab XDF.test
c4.5 -f XDF -u $treeopts >$1.to$i$suffix
c4.5rules -f XDF -u $ruleopts >$1.ro$i$suffix
@ i++
end
# remove the temporary files and summarize results
rm -f XDF.*
cat $1.to[0-9]*$suffix | grep "<<" | average >$1.tres$suffix
cat $1.ro[0-9]*$suffix | grep "<<" | average >$1.rres$suffix
Ostatnio zmieniony 08 kwie 2011, 14:44 przez xbw, łącznie zmieniany 1 raz.
Sądząc gdzie ci się pojawia błąd oraz na podstawie tego [sarkazm]jak wiele informacji nam podałeś[/sarkazm] wnioskuje, że problem leży pomiędzy fotelem a monitorem.
#---------------------------------------------------------------------
# N-way cross-validation script
#---------------------------------------------------------------------
# # invocation:
# csh xval.sh filestem N [options for c4.5 and c4.5rules] [suffix]
#
# individual results from each block are left in
# filestem.[rt]o*[suffix],
# averages over all blocks in
# filestem.[rt]res[suffix]
#---------------------------------------------------------------------
# sort the options into result suffix and control options for the programs
# Note: for options with values, there must be no space between the option
# name and value; e.g. "-v1", not "-v 1"
Przeczytałeś informacje, które są zamieszczone w skrypcie? Szczególnie to co wytłuściłem.
Jeżeli chcesz abyśmy pomogli, to przydałoby się trochę informacji. Na przykład skopiuj z konsoli wszystko ci ci wypluwa (włączenie z tym jak uruchamiasz skrypt) i wklej tutaj.
Poniższe zdanie jest fałszywe.
Powyższe zdanie jest prawdziwe.
emsi@emsi-desktop:~/Pulpit/R8/Src$ ./xval.sh
./xval.sh: line 26: błąd składni przy nieoczekiwanym znaczniku `('
./xval.sh: line 26: `foreach i ($argv[3-] )'
emsi@emsi-desktop:~/Pulpit/R8/Src$
c4.5 i c4.5rules są skompilowane i znajdują się w tym samym folderze co skrypt.
emsi@emsi-desktop:~/Pulpit/R8/Src$ csh xval.sh
xval-prep: Command not found.
cat: .data: No such file or directory
cat: .test: No such file or directory
ln: dostęp do `.names': No such file or directory
rm: No match.
expr: błąd składni
expr: błąd składni
cat: No match.
average: Command not found.
cat: No match.
average: Command not found.
Zmień tytuł tematu tak, aby w sposób możliwie precyzyjny przedstawiał sedno sprawy, w której piszesz. Miej na uwadze również zgodność z REGULAMINEM Tytuł tematu zmienisz edytując pierwszy post
W razie wątpliwości/zastrzeżeń odnośnie powyższej informacji skontaktuj się z moderatorem, który ją wstawił.