What are the possibilities for self-modification o

2019-09-20 09:45发布

Could you list the possibilities for Java code to modify itself? The scenario in which this is going to be used is a learning program. In response to user input the program learns a new algorithm:

  1. it looks up the existing code base for a similar algorithm
  2. if no similar algorithm is in the code base, the program just adds a new algorithm
  3. if a similar algorithm exists, the program (perhaps with some help from the user) modifies the existing algorithm to be able to serve both the old purpose and the new purpose

A similar question exists Self modifying code in Java , but at that time the latest Java available was 6, and that question was closed as too broad.

1条回答
对你真心纯属浪费
2楼-- · 2019-09-20 10:08

A Java program can dynamically compile and load automatically-generated classes (see JavaCompiler), but I don't think that it is what a machine-learning program would do. Most certainly, the programmer creates an algorithm depending on several parameters to estimate, and running the program simply consists in finding optimal values for those parameters.

查看更多
登录 后发表回答