shivaseの日記

SIer→Web→教師→SIer→ベンチャー(SRE)と異色な人生を歩んでいるエンジニアの日記

Machine Learning - Week2 Octave 4.0で課題をする時のエラー

Lesson2から課題提出がありますが、octave 4.0で実行すると以下のようなエラーになります

❯❯ submit
== Submitting solutions | Linear Regression with Multiple Variables...
Login (email address): *******@gmail.com
Token: ********
!! Submission failed: Please check your email address and submission token. If you still experience problems, regenerate your token on the assignment page and try submitting again.
❯❯

CourseraのMachine Learningはoctave 3.8で実施する事を想定しているので、現状の課題提出ソースコードに互換性で問題があるようです。

It seems that the conversion from ASCII to the hexadecimal escape the jsonlib uses is not working properly anymore in Octave 4.0

linear-regression submit error – Coursera Help Center

修正方法は上記リンクにも書いていますが、ex1/lib/jsonlab/loadjson.m及びex1/lib/makeValidFieldName.mにある以下の2箇所を修正すれば治ります。

str=[str str0(pos0(i)+1:pos(i)-1) sprintf('_0x%X_',str0(pos(i)))];
⇓ toasciiを追加する
str=[str str0(pos0(i)+1:pos(i)-1) sprintf('_0x%X_',toascii(str0(pos(i))))];
str=sprintf('x0x%X_%s',char(str(1)),str(2:end));
⇓ charをtoasciiに変更する
str=sprintf('x0x%X_%s',toascii(str(1)),str(2:end));

現状はoctave 3.8をインストールし直すのが楽だと思いますが、homebrewで入るのは4.0。今後の課題提出も同様だったらどうにかしよう。。。

【スポンサーリンク】