Comments (2)
I printed these loss values after each training epoch.
You could do this personalized requirement by yourself.
issue closed.
from couta.
Add 4 lines code at src/algorithms/couta_algo.py
, can save info in a "train_log.txt" file.
...
val_loss = torch.mean(torch.stack(val_loss)).data.cpu().item()
# start
loss_file = "train_log.txt"
_f = open(loss_file, "a")
print(f'epoch: {i+1:02},loss: {epoch_loss:.6f},loss_oc: {epoch_loss_oc:.6f}, val_loss: {val_loss:.6f}',
file=_f, flush=True)
_f.close()
#end
if (i+1) % 10 == 0:
...
And then use following code to transform it into a csv file:
import numpy as np
import pandas as pd
with open("train_log.txt", "r") as f:
data = f.readlines()
n = len(data)
result = np.zeros([n, 4])
for i in range(n):
record = data[i].split(",")
epoch = int(record[0].split(" ")[-1])
loss = float(record[1].split(" ")[-1])
loss_oc = float(record[2].split(" ")[-1])
val_loss = float(record[3].split(" ")[-1])
print(epoch, loss, loss_oc, val_loss)
result[i, :] = [epoch, loss, loss_oc, val_loss]
df = pd.DataFrame(data=result, columns=["epoch", "loss", "loss_oc", "val_loss"])
df.to_csv("loss_curve.csv")
from couta.
Related Issues (5)
- Saving model HOT 4
- train HOT 7
- train HOT 3
- question about data perturbation HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from couta.