# US 2023/0409976 A1 · Rewriting method and information processing apparatus

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 2023/0409976 A1
- Document ID: US20230409976A1
- Status: Published application
- Kind: A1
- Application number: 18/299,875
- Filed: 2023-04-13
- Published: 2023-12-21
- Earliest claimed: 2022-06-16
- Assignees: Fujitsu Limited
- Applicants: Fujitsu Limited
- Inventors: Kosaku KIMURA; Shade RUANGWAN
- Web page: https://patentgrep.com/patent/US20230409976A1

## CPC

- G06N 20/00: Machine learning
- G06F 40/295: Named entity recognition
- G06F 40/30: Semantic analysis
- G06N 3/08: Learning methods
- G06N 3/082: modifying the architecture, e.g. adding, deleting or silencing nodes or connections
- G06N 3/10: Interfaces, programming languages or software development kits, e.g. for simulating neural networks
- G06N: COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

A computer detects, based on a module name of a module included in a machine learning library, a first code for calling a training function for training a machine learning model from a machine learning program. The computer inserts, before the first code, second code for splitting first training data passed to the training function into second training data and test data. The computer rewrites the first code to pass the second training data to the training function. The computer inserts, after the first code, third code for calculating a score based on prediction data, which is generated from the trained machine learning model and input data included in the test data, and correct answer data included in the test data.

## Claims

### Claim 1

A non-transitory computer-readable recording medium storing therein a computer program that causes a computer to execute a process comprising:
detecting, based on a module name of a module included in a machine learning library, first code for calling a training function for training a machine learning model from a machine learning program that uses the machine learning library;
inserting, before the first code, second code for splitting first training data passed to the training function by the first code into second training data and test data;
rewriting the first code to pass the second training data to the training function; and
inserting, after the first code, third code for calculating a score based on prediction data, which is generated from the machine learning model that has been trained and input data included in the test data, and correct answer data included in the test data.

### Claim 2 (depends on 1)

The non-transitory computer-readable recording medium according to claim 1, wherein
the process further includes extracting the module name from a document indicating how to use the machine learning library, and
the detecting of the first code includes searching the machine learning program for the module name extracted from the document.

### Claim 3 (depends on 1)

The non-transitory computer-readable recording medium according to claim 1, wherein
the detecting of the first code includes performing syntactic analysis of the machine learning program to generate an abstract syntax tree and detecting the first code using the abstract syntax tree.

### Claim 4 (depends on 1)

The non-transitory computer-readable recording medium according to claim 1, wherein
the inserting of the third code includes detecting, from the machine learning program, fourth code for calling a prediction function that generates the prediction data using the machine learning model and rewriting the fourth code to pass the input data to the prediction function.

### Claim 5 (depends on 1)

The non-transitory computer-readable recording medium according to claim 1, wherein
the module is a class that expresses the machine learning model and the training function is a method included in the class.

### Claim 6 (depends on 1)

The non-transitory computer-readable recording medium according to claim 1, wherein
the process further includes executing the machine learning program that has been rewritten using the first training data and storing the score that has been calculated in association with the machine learning program before rewriting.

### Claim 7

A rewriting method comprising:
detecting, by a processor and based on a module name of a module included in a machine learning library, first code for calling a training function for training a machine learning model from a machine learning program that uses the machine learning library;
inserting, by the processor and before the first code, second code for splitting first training data passed to the training function by the first code into second training data and test data;
rewriting, by the processor, the first code to pass the second training data to the training function; and
inserting, by the processor and after the first code, third code for calculating a score based on prediction data, which is generated from the machine learning model that has been trained and input data included in the test data, and correct answer data included in the test data.

### Claim 8

An information processing apparatus comprising:
a memory configured to store a machine learning program that uses a machine learning library; and
a processor coupled to the memory and the processor configured to:
detect, based on a module name of a module included in the machine learning library, first code for calling a training function for training a machine learning model from the machine learning program;
insert, before the first code, second code for splitting first training data passed to the training function by the first code into second training data and test data;
rewrite the first code to pass the second training data to the training function; and
insert, after the first code, third code for calculating a score based on prediction data, which is generated from the machine learning model that has been trained and input data included in the test data, and correct answer data included in the test data.
