luigibonati / mlcolvar

A unified framework for machine learning collective variables for enhanced sampling simulations
MIT License
89 stars 24 forks source link

why not a standard form for linear model? #26

Closed thangckt closed 1 year ago

thangckt commented 1 year ago

Dear @luigibonati

Can i have a silly question about the linear model implemented in your code at: https://github.com/luigibonati/mlcvs/blob/main/mlcvs/models/linear.py

You used

s = torch.matmul(X - self.b, self.w)

instead of a standard form y = weight * X + bias

Is there any specific purpose for that?

luigibonati commented 1 year ago

Hi @thangckt, sorry for the delay. We are currently restructuring the entire code with new features and cvs. The reason behind that choice was the fact that the linear models are meant to be linear projections along a vector (e.g. linear discriminant or tica eigenvectors) rather than standard linear layers. So actually only the weights were used, and the bias was provided only for convenience (e..g for removing the mean to the inputs before applying the transformation).