File cleanup: remove commented print statements and some commented code#44
File cleanup: remove commented print statements and some commented code#44zurabksmlp wants to merge 4 commits intomasterfrom
Conversation
fbrausse
left a comment
There was a problem hiding this comment.
Nice PR, looks good to me, thanks. Just a few questions:
| #true_pred_df = data.frame(true= bin_true_vec, pred=bin_pred_vec) | ||
| #kappa2_res = kappa2(true_pred_df, "unweighted"); | ||
| #kappa2_res = kappa2(true_pred_df, "squared"); | ||
| #cohen_kappa = kappa2_res$value; #pnv(cohen_kappa); | ||
| #cohen_kappa = kappa2_res$value | ||
| #true_pred_categ_df = data.frame(true=factor(bin_true_vec, levels=c(0,1)), | ||
| # pred=factor(bin_pred_vec, levels=c(0,1))); pnv(true_pred_categ_df); | ||
| # pred=factor(bin_pred_vec, levels=c(0,1))) |
There was a problem hiding this comment.
Do we still need this commented code?
| #pos_expectation = (predicted_negative/samples_count)*true_negative | ||
| #neg_expectation = (predicted_positive/samples_count)*TP |
There was a problem hiding this comment.
Same question: do we still need this commented code?
| #pos.scores = pos_prob_vec[bin_true_vec_pos] | ||
| #neg.scores = pos_prob_vec[bin_true_vec_neg] |
There was a problem hiding this comment.
And again: do we need this?
| solver.add(query) | ||
| res = self._modelTermsInst.smlp_solver_check(solver, 'witness_consistency') | ||
| #res = solver.check(); #print('res', res) | ||
| #res = solver.check() |
There was a problem hiding this comment.
Let's remove this commented line as well.
|
In most cases, I kept the commented lines because they provide alternative
implementation and I was not sure which implementation is best. So these
lines are a reminder like the TODO comments that a revision might be
relevant. You can see such commented out lines in many places, even
functions like
# equality
@conditional_cache ***@***.***
def smlp_eq(self, term1:smlp.term2, term2:smlp.term2):
res1 = op.eq(term1, term2)
#res2 = term1 == term2
#assert res1 == res2
return res1
Here you see an alternative implementation and sanity check that is
commented out. I am not sure specifically for these functions, but from
what I remember using different implementations did affect performance of
some of the tests.
Yes, in some cases some commented out code can be safely removed such as in
the case you have pointed out (that variable ft is never used) but it was
not my intention to make a full cleanup.
Zurab
<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
Virus-free.www.avast.com
<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
…On Sat, Feb 7, 2026 at 2:45 PM Franz Brauße ***@***.***> wrote:
***@***.**** commented on this pull request.
Nice PR, looks good to me, thanks. Just a few questions:
------------------------------
In src/smlp_py/smlp_precisions.py
<#44 (comment)>:
> + #true_pred_df = data.frame(true= bin_true_vec, pred=bin_pred_vec)
#kappa2_res = kappa2(true_pred_df, "unweighted");
#kappa2_res = kappa2(true_pred_df, "squared");
- #cohen_kappa = kappa2_res$value; #pnv(cohen_kappa);
+ #cohen_kappa = kappa2_res$value
#true_pred_categ_df = data.frame(true=factor(bin_true_vec, levels=c(0,1)),
- # pred=factor(bin_pred_vec, levels=c(0,1))); pnv(true_pred_categ_df);
+ # pred=factor(bin_pred_vec, levels=c(0,1)))
Do we still need this commented code?
------------------------------
In src/smlp_py/smlp_precisions.py
<#44 (comment)>:
> + #pos_expectation = (predicted_negative/samples_count)*true_negative
+ #neg_expectation = (predicted_positive/samples_count)*TP
Same question: do we still need this commented code?
------------------------------
In src/smlp_py/smlp_precisions.py
<#44 (comment)>:
> + #pos.scores = pos_prob_vec[bin_true_vec_pos]
+ #neg.scores = pos_prob_vec[bin_true_vec_neg]
And again: do we need this?
------------------------------
In src/smlp_py/smlp_query.py
<#44 (comment)>:
> if query is not None:
solver.add(query)
res = self._modelTermsInst.smlp_solver_check(solver, 'witness_consistency')
- #res = solver.check(); #print('res', res)
+ #res = solver.check()
Let's remove this commented line as well.
------------------------------
In src/smlp_py/smlp_subgroups.py
<#44 (comment)>:
> else:
- #ft = feat_df[rng_tuple['name']]; #print('ft\n', ft); print(rng_tuple['hi'], rng_tuple['lo'])
- #print(rng_tuple); print(rng_tuple$hi); print(rng_tuple$lo)
+ #ft = feat_df[rng_tuple['name']]
I don't think ft is used anywhere, so this commented line should be safe
to remove as well.
—
Reply to this email directly, view it on GitHub
<#44 (review)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/BPWPDL7LH3MKPXOCKGLPOVT4KXM45AVCNFSM6AAAAACUKFRUUSVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZTONRWHE3DGNBWGE>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
|
By the way , pnv() was a function in EVA that would print the name and the
value of a variable (in R language).
In Python, I use print('x', x), with pnv() it would be pnv(x).
I remember I tried to write such a function in Python since it is very
handy, but I could not do it.
If you know how to do it, let me know.
Zurab
<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
Virus-free.www.avast.com
<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
On Sat, Feb 7, 2026 at 3:00 PM Zurab Khasidashvili <
***@***.***> wrote:
… In most cases, I kept the commented lines because they provide alternative
implementation and I was not sure which implementation is best. So these
lines are a reminder like the TODO comments that a revision might be
relevant. You can see such commented out lines in many places, even
functions like
# equality
@conditional_cache ***@***.***
def smlp_eq(self, term1:smlp.term2, term2:smlp.term2):
res1 = op.eq(term1, term2)
#res2 = term1 == term2
#assert res1 == res2
return res1
Here you see an alternative implementation and sanity check that is
commented out. I am not sure specifically for these functions, but from
what I remember using different implementations did affect performance of
some of the tests.
Yes, in some cases some commented out code can be safely removed such as
in the case you have pointed out (that variable ft is never used) but it
was not my intention to make a full cleanup.
Zurab
<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
Virus-free.www.avast.com
<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
<#m_1703351304392304679_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
On Sat, Feb 7, 2026 at 2:45 PM Franz Brauße ***@***.***>
wrote:
> ***@***.**** commented on this pull request.
>
> Nice PR, looks good to me, thanks. Just a few questions:
> ------------------------------
>
> In src/smlp_py/smlp_precisions.py
> <#44 (comment)>:
>
> > + #true_pred_df = data.frame(true= bin_true_vec, pred=bin_pred_vec)
> #kappa2_res = kappa2(true_pred_df, "unweighted");
> #kappa2_res = kappa2(true_pred_df, "squared");
> - #cohen_kappa = kappa2_res$value; #pnv(cohen_kappa);
> + #cohen_kappa = kappa2_res$value
> #true_pred_categ_df = data.frame(true=factor(bin_true_vec, levels=c(0,1)),
> - # pred=factor(bin_pred_vec, levels=c(0,1))); pnv(true_pred_categ_df);
> + # pred=factor(bin_pred_vec, levels=c(0,1)))
>
> Do we still need this commented code?
> ------------------------------
>
> In src/smlp_py/smlp_precisions.py
> <#44 (comment)>:
>
> > + #pos_expectation = (predicted_negative/samples_count)*true_negative
> + #neg_expectation = (predicted_positive/samples_count)*TP
>
> Same question: do we still need this commented code?
> ------------------------------
>
> In src/smlp_py/smlp_precisions.py
> <#44 (comment)>:
>
> > + #pos.scores = pos_prob_vec[bin_true_vec_pos]
> + #neg.scores = pos_prob_vec[bin_true_vec_neg]
>
> And again: do we need this?
> ------------------------------
>
> In src/smlp_py/smlp_query.py
> <#44 (comment)>:
>
> > if query is not None:
> solver.add(query)
> res = self._modelTermsInst.smlp_solver_check(solver, 'witness_consistency')
> - #res = solver.check(); #print('res', res)
> + #res = solver.check()
>
> Let's remove this commented line as well.
> ------------------------------
>
> In src/smlp_py/smlp_subgroups.py
> <#44 (comment)>:
>
> > else:
> - #ft = feat_df[rng_tuple['name']]; #print('ft\n', ft); print(rng_tuple['hi'], rng_tuple['lo'])
> - #print(rng_tuple); print(rng_tuple$hi); print(rng_tuple$lo)
> + #ft = feat_df[rng_tuple['name']]
>
> I don't think ft is used anywhere, so this commented line should be safe
> to remove as well.
>
> —
> Reply to this email directly, view it on GitHub
> <#44 (review)>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/BPWPDL7LH3MKPXOCKGLPOVT4KXM45AVCNFSM6AAAAACUKFRUUSVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZTONRWHE3DGNBWGE>
> .
> You are receiving this because you authored the thread.Message ID:
> ***@***.***>
>
|
|
To print name and value you can use
print(f"{var_name = }")
https://stackoverflow.com/questions/32000934/print-a-variables-name-and-value/57225950#57225950
foo = 1
bar = 2
print(f"{foo = } {bar =}")
produces:
foo = 1 bar =2
…On Sat, 7 Feb 2026 at 13:04, zurabksmlp ***@***.***> wrote:
*zurabksmlp* left a comment (SMLP-Systems/smlp#44)
<#44 (comment)>
By the way , pnv() was a function in EVA that would print the name and the
value of a variable (in R language).
In Python, I use print('x', x), with pnv() it would be pnv(x).
I remember I tried to write such a function in Python since it is very
handy, but I could not do it.
If you know how to do it, let me know.
Zurab
<
https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
Virus-free.www.avast.com
<
https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
On Sat, Feb 7, 2026 at 3:00 PM Zurab Khasidashvili <
***@***.***> wrote:
> In most cases, I kept the commented lines because they provide
alternative
> implementation and I was not sure which implementation is best. So these
> lines are a reminder like the TODO comments that a revision might be
> relevant. You can see such commented out lines in many places, even
> functions like
>
> # equality
> @conditional_cache ***@***.***
> def smlp_eq(self, term1:smlp.term2, term2:smlp.term2):
> res1 = op.eq(term1, term2)
> #res2 = term1 == term2
> #assert res1 == res2
> return res1
>
> Here you see an alternative implementation and sanity check that is
> commented out. I am not sure specifically for these functions, but from
> what I remember using different implementations did affect performance
of
> some of the tests.
>
> Yes, in some cases some commented out code can be safely removed such as
> in the case you have pointed out (that variable ft is never used) but it
> was not my intention to make a full cleanup.
>
> Zurab
>
>
> <
https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
> Virus-free.www.avast.com
> <
https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
> <#m_1703351304392304679_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
>
> On Sat, Feb 7, 2026 at 2:45 PM Franz Brauße ***@***.***>
> wrote:
>
>> ***@***.**** commented on this pull request.
>>
>> Nice PR, looks good to me, thanks. Just a few questions:
>> ------------------------------
>>
>> In src/smlp_py/smlp_precisions.py
>> <#44 (comment)>:
>>
>> > + #true_pred_df = data.frame(true= bin_true_vec, pred=bin_pred_vec)
>> #kappa2_res = kappa2(true_pred_df, "unweighted");
>> #kappa2_res = kappa2(true_pred_df, "squared");
>> - #cohen_kappa = kappa2_res$value; #pnv(cohen_kappa);
>> + #cohen_kappa = kappa2_res$value
>> #true_pred_categ_df = data.frame(true=factor(bin_true_vec,
levels=c(0,1)),
>> - # pred=factor(bin_pred_vec, levels=c(0,1))); pnv(true_pred_categ_df);
>> + # pred=factor(bin_pred_vec, levels=c(0,1)))
>>
>> Do we still need this commented code?
>> ------------------------------
>>
>> In src/smlp_py/smlp_precisions.py
>> <#44 (comment)>:
>>
>> > + #pos_expectation = (predicted_negative/samples_count)*true_negative
>> + #neg_expectation = (predicted_positive/samples_count)*TP
>>
>> Same question: do we still need this commented code?
>> ------------------------------
>>
>> In src/smlp_py/smlp_precisions.py
>> <#44 (comment)>:
>>
>> > + #pos.scores = pos_prob_vec[bin_true_vec_pos]
>> + #neg.scores = pos_prob_vec[bin_true_vec_neg]
>>
>> And again: do we need this?
>> ------------------------------
>>
>> In src/smlp_py/smlp_query.py
>> <#44 (comment)>:
>>
>> > if query is not None:
>> solver.add(query)
>> res = self._modelTermsInst.smlp_solver_check(solver,
'witness_consistency')
>> - #res = solver.check(); #print('res', res)
>> + #res = solver.check()
>>
>> Let's remove this commented line as well.
>> ------------------------------
>>
>> In src/smlp_py/smlp_subgroups.py
>> <#44 (comment)>:
>>
>> > else:
>> - #ft = feat_df[rng_tuple['name']]; #print('ft\n', ft);
print(rng_tuple['hi'], rng_tuple['lo'])
>> - #print(rng_tuple); print(rng_tuple$hi); print(rng_tuple$lo)
>> + #ft = feat_df[rng_tuple['name']]
>>
>> I don't think ft is used anywhere, so this commented line should be
safe
>> to remove as well.
>>
>> —
>> Reply to this email directly, view it on GitHub
>> <
#44 (review)>,
>> or unsubscribe
>> <
https://github.com/notifications/unsubscribe-auth/BPWPDL7LH3MKPXOCKGLPOVT4KXM45AVCNFSM6AAAAACUKFRUUSVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZTONRWHE3DGNBWGE>
>> .
>> You are receiving this because you authored the thread.Message ID:
>> ***@***.***>
>>
>
—
Reply to this email directly, view it on GitHub
<#44 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AIVYHTJ4WB7BKPQCXPT3QIL4KXPF7AVCNFSM6AAAAACUKFRUUSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTQNRUGQ4DKMJWGA>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
|
@zurabksmlp Thanks. I did merge your previous PR #43, so now Github lets us know that there are conflicts between master and this PR #44. Could I ask you to please resolve those conflicts? You could either use the web interface or try to do that locally via |
|
Thanks Konstantin, it is a good idea but still requires typing extra
characters like f" {} " and is not significantly quicker. but it is a
good idea because maybe one can use *kwargs for that purpose.
If I simply define:
def pnv(x):
print(f"x = {x}")
y = 7
pnv(y)
then x = 7 is printed instead of y = 7.
<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
Virus-free.www.avast.com
<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
On Sat, Feb 7, 2026 at 3:30 PM konstantin-korovin ***@***.***>
wrote:
… *konstantin-korovin* left a comment (SMLP-Systems/smlp#44)
<#44 (comment)>
To print name and value you can use
print(f"{var_name = }")
https://stackoverflow.com/questions/32000934/print-a-variables-name-and-value/57225950#57225950
foo = 1
bar = 2
print(f"{foo = } {bar =}")
produces:
foo = 1 bar =2
On Sat, 7 Feb 2026 at 13:04, zurabksmlp ***@***.***> wrote:
> *zurabksmlp* left a comment (SMLP-Systems/smlp#44)
> <#44 (comment)>
> By the way , pnv() was a function in EVA that would print the name and
the
> value of a variable (in R language).
> In Python, I use print('x', x), with pnv() it would be pnv(x).
>
> I remember I tried to write such a function in Python since it is very
> handy, but I could not do it.
> If you know how to do it, let me know.
>
> Zurab
>
> <
>
https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
>
> Virus-free.www.avast.com
> <
>
https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
>
> <#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
>
> On Sat, Feb 7, 2026 at 3:00 PM Zurab Khasidashvili <
> ***@***.***> wrote:
>
> > In most cases, I kept the commented lines because they provide
> alternative
> > implementation and I was not sure which implementation is best. So
these
> > lines are a reminder like the TODO comments that a revision might be
> > relevant. You can see such commented out lines in many places, even
> > functions like
> >
> > # equality
> > @conditional_cache ***@***.***
> > def smlp_eq(self, term1:smlp.term2, term2:smlp.term2):
> > res1 = op.eq(term1, term2)
> > #res2 = term1 == term2
> > #assert res1 == res2
> > return res1
> >
> > Here you see an alternative implementation and sanity check that is
> > commented out. I am not sure specifically for these functions, but
from
> > what I remember using different implementations did affect performance
> of
> > some of the tests.
> >
> > Yes, in some cases some commented out code can be safely removed such
as
> > in the case you have pointed out (that variable ft is never used) but
it
> > was not my intention to make a full cleanup.
> >
> > Zurab
> >
> >
> > <
>
https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
>
> > Virus-free.www.avast.com
> > <
>
https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
>
> > <#m_1703351304392304679_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
> >
> > On Sat, Feb 7, 2026 at 2:45 PM Franz Brauße ***@***.***>
> > wrote:
> >
> >> ***@***.**** commented on this pull request.
> >>
> >> Nice PR, looks good to me, thanks. Just a few questions:
> >> ------------------------------
> >>
> >> In src/smlp_py/smlp_precisions.py
> >> <#44 (comment)>:
> >>
> >> > + #true_pred_df = data.frame(true= bin_true_vec, pred=bin_pred_vec)
> >> #kappa2_res = kappa2(true_pred_df, "unweighted");
> >> #kappa2_res = kappa2(true_pred_df, "squared");
> >> - #cohen_kappa = kappa2_res$value; #pnv(cohen_kappa);
> >> + #cohen_kappa = kappa2_res$value
> >> #true_pred_categ_df = data.frame(true=factor(bin_true_vec,
> levels=c(0,1)),
> >> - # pred=factor(bin_pred_vec, levels=c(0,1)));
pnv(true_pred_categ_df);
> >> + # pred=factor(bin_pred_vec, levels=c(0,1)))
> >>
> >> Do we still need this commented code?
> >> ------------------------------
> >>
> >> In src/smlp_py/smlp_precisions.py
> >> <#44 (comment)>:
> >>
> >> > + #pos_expectation =
(predicted_negative/samples_count)*true_negative
> >> + #neg_expectation = (predicted_positive/samples_count)*TP
> >>
> >> Same question: do we still need this commented code?
> >> ------------------------------
> >>
> >> In src/smlp_py/smlp_precisions.py
> >> <#44 (comment)>:
> >>
> >> > + #pos.scores = pos_prob_vec[bin_true_vec_pos]
> >> + #neg.scores = pos_prob_vec[bin_true_vec_neg]
> >>
> >> And again: do we need this?
> >> ------------------------------
> >>
> >> In src/smlp_py/smlp_query.py
> >> <#44 (comment)>:
> >>
> >> > if query is not None:
> >> solver.add(query)
> >> res = self._modelTermsInst.smlp_solver_check(solver,
> 'witness_consistency')
> >> - #res = solver.check(); #print('res', res)
> >> + #res = solver.check()
> >>
> >> Let's remove this commented line as well.
> >> ------------------------------
> >>
> >> In src/smlp_py/smlp_subgroups.py
> >> <#44 (comment)>:
> >>
> >> > else:
> >> - #ft = feat_df[rng_tuple['name']]; #print('ft\n', ft);
> print(rng_tuple['hi'], rng_tuple['lo'])
> >> - #print(rng_tuple); print(rng_tuple$hi); print(rng_tuple$lo)
> >> + #ft = feat_df[rng_tuple['name']]
> >>
> >> I don't think ft is used anywhere, so this commented line should be
> safe
> >> to remove as well.
> >>
> >> —
> >> Reply to this email directly, view it on GitHub
> >> <
>
#44 (review)>,
>
> >> or unsubscribe
> >> <
>
https://github.com/notifications/unsubscribe-auth/BPWPDL7LH3MKPXOCKGLPOVT4KXM45AVCNFSM6AAAAACUKFRUUSVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZTONRWHE3DGNBWGE>
>
> >> .
> >> You are receiving this because you authored the thread.Message ID:
> >> ***@***.***>
> >>
> >
>
> —
> Reply to this email directly, view it on GitHub
> <#44 (comment)>,
> or unsubscribe
> <
https://github.com/notifications/unsubscribe-auth/AIVYHTJ4WB7BKPQCXPT3QIL4KXPF7AVCNFSM6AAAAACUKFRUUSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTQNRUGQ4DKMJWGA>
> .
> You are receiving this because you are subscribed to this thread.Message
> ID: ***@***.***>
>
—
Reply to this email directly, view it on GitHub
<#44 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/BPWPDL7EVLQM5OFHLMXFXTL4KXSFXAVCNFSM6AAAAACUKFRUUSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTQNRUGUYTEMJSGM>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
|
Done -- executed:
(venv_3.12.3) ***@***.***:~/smlp/repo/smlp/src$ git rebase
master file-cleanup2
Current branch file-cleanup2 is up to date.
Zurab
<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
Virus-free.www.avast.com
<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
On Sat, Feb 7, 2026 at 3:46 PM Zurab Khasidashvili <
***@***.***> wrote:
… Thanks Konstantin, it is a good idea but still requires typing extra
characters like f" {} " and is not significantly quicker. but it is a
good idea because maybe one can use *kwargs for that purpose.
If I simply define:
def pnv(x):
print(f"x = {x}")
y = 7
pnv(y)
then x = 7 is printed instead of y = 7.
<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
Virus-free.www.avast.com
<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
<#m_-8140363696942388275_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
On Sat, Feb 7, 2026 at 3:30 PM konstantin-korovin <
***@***.***> wrote:
> *konstantin-korovin* left a comment (SMLP-Systems/smlp#44)
> <#44 (comment)>
> To print name and value you can use
>
> print(f"{var_name = }")
>
>
>
> https://stackoverflow.com/questions/32000934/print-a-variables-name-and-value/57225950#57225950
>
>
> foo = 1
> bar = 2
>
> print(f"{foo = } {bar =}")
>
> produces:
>
> foo = 1 bar =2
>
>
> On Sat, 7 Feb 2026 at 13:04, zurabksmlp ***@***.***> wrote:
>
> > *zurabksmlp* left a comment (SMLP-Systems/smlp#44)
> > <#44 (comment)>
> > By the way , pnv() was a function in EVA that would print the name and
> the
> > value of a variable (in R language).
> > In Python, I use print('x', x), with pnv() it would be pnv(x).
> >
> > I remember I tried to write such a function in Python since it is very
> > handy, but I could not do it.
> > If you know how to do it, let me know.
> >
> > Zurab
> >
> > <
> >
> https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
>
> >
> > Virus-free.www.avast.com
> > <
> >
> https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
>
> >
> > <#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
> >
> > On Sat, Feb 7, 2026 at 3:00 PM Zurab Khasidashvili <
> > ***@***.***> wrote:
> >
> > > In most cases, I kept the commented lines because they provide
> > alternative
> > > implementation and I was not sure which implementation is best. So
> these
> > > lines are a reminder like the TODO comments that a revision might be
> > > relevant. You can see such commented out lines in many places, even
> > > functions like
> > >
> > > # equality
> > > @conditional_cache ***@***.***
> > > def smlp_eq(self, term1:smlp.term2, term2:smlp.term2):
> > > res1 = op.eq(term1, term2)
> > > #res2 = term1 == term2
> > > #assert res1 == res2
> > > return res1
> > >
> > > Here you see an alternative implementation and sanity check that is
> > > commented out. I am not sure specifically for these functions, but
> from
> > > what I remember using different implementations did affect
> performance
> > of
> > > some of the tests.
> > >
> > > Yes, in some cases some commented out code can be safely removed such
> as
> > > in the case you have pointed out (that variable ft is never used) but
> it
> > > was not my intention to make a full cleanup.
> > >
> > > Zurab
> > >
> > >
> > > <
> >
> https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
>
> >
> > > Virus-free.www.avast.com
> > > <
> >
> https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
>
> >
> > > <#m_1703351304392304679_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
> > >
> > > On Sat, Feb 7, 2026 at 2:45 PM Franz Brauße ***@***.***>
> > > wrote:
> > >
> > >> ***@***.**** commented on this pull request.
> > >>
> > >> Nice PR, looks good to me, thanks. Just a few questions:
> > >> ------------------------------
> > >>
> > >> In src/smlp_py/smlp_precisions.py
> > >> <#44 (comment)>:
>
> > >>
> > >> > + #true_pred_df = data.frame(true= bin_true_vec,
> pred=bin_pred_vec)
> > >> #kappa2_res = kappa2(true_pred_df, "unweighted");
> > >> #kappa2_res = kappa2(true_pred_df, "squared");
> > >> - #cohen_kappa = kappa2_res$value; #pnv(cohen_kappa);
> > >> + #cohen_kappa = kappa2_res$value
> > >> #true_pred_categ_df = data.frame(true=factor(bin_true_vec,
> > levels=c(0,1)),
> > >> - # pred=factor(bin_pred_vec, levels=c(0,1)));
> pnv(true_pred_categ_df);
> > >> + # pred=factor(bin_pred_vec, levels=c(0,1)))
> > >>
> > >> Do we still need this commented code?
> > >> ------------------------------
> > >>
> > >> In src/smlp_py/smlp_precisions.py
> > >> <#44 (comment)>:
>
> > >>
> > >> > + #pos_expectation =
> (predicted_negative/samples_count)*true_negative
> > >> + #neg_expectation = (predicted_positive/samples_count)*TP
> > >>
> > >> Same question: do we still need this commented code?
> > >> ------------------------------
> > >>
> > >> In src/smlp_py/smlp_precisions.py
> > >> <#44 (comment)>:
>
> > >>
> > >> > + #pos.scores = pos_prob_vec[bin_true_vec_pos]
> > >> + #neg.scores = pos_prob_vec[bin_true_vec_neg]
> > >>
> > >> And again: do we need this?
> > >> ------------------------------
> > >>
> > >> In src/smlp_py/smlp_query.py
> > >> <#44 (comment)>:
>
> > >>
> > >> > if query is not None:
> > >> solver.add(query)
> > >> res = self._modelTermsInst.smlp_solver_check(solver,
> > 'witness_consistency')
> > >> - #res = solver.check(); #print('res', res)
> > >> + #res = solver.check()
> > >>
> > >> Let's remove this commented line as well.
> > >> ------------------------------
> > >>
> > >> In src/smlp_py/smlp_subgroups.py
> > >> <#44 (comment)>:
>
> > >>
> > >> > else:
> > >> - #ft = feat_df[rng_tuple['name']]; #print('ft\n', ft);
> > print(rng_tuple['hi'], rng_tuple['lo'])
> > >> - #print(rng_tuple); print(rng_tuple$hi); print(rng_tuple$lo)
> > >> + #ft = feat_df[rng_tuple['name']]
> > >>
> > >> I don't think ft is used anywhere, so this commented line should be
> > safe
> > >> to remove as well.
> > >>
> > >> —
> > >> Reply to this email directly, view it on GitHub
> > >> <
> >
> #44 (review)>,
>
> >
> > >> or unsubscribe
> > >> <
> >
> https://github.com/notifications/unsubscribe-auth/BPWPDL7LH3MKPXOCKGLPOVT4KXM45AVCNFSM6AAAAACUKFRUUSVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZTONRWHE3DGNBWGE>
>
> >
> > >> .
> > >> You are receiving this because you authored the thread.Message ID:
> > >> ***@***.***>
> > >>
> > >
> >
> > —
> > Reply to this email directly, view it on GitHub
> > <#44 (comment)>,
>
> > or unsubscribe
> > <
> https://github.com/notifications/unsubscribe-auth/AIVYHTJ4WB7BKPQCXPT3QIL4KXPF7AVCNFSM6AAAAACUKFRUUSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTQNRUGQ4DKMJWGA>
>
> > .
> > You are receiving this because you are subscribed to this
> thread.Message
> > ID: ***@***.***>
> >
>
> —
> Reply to this email directly, view it on GitHub
> <#44 (comment)>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/BPWPDL7EVLQM5OFHLMXFXTL4KXSFXAVCNFSM6AAAAACUKFRUUSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTQNRUGUYTEMJSGM>
> .
> You are receiving this because you authored the thread.Message ID:
> ***@***.***>
>
|
|
Variable names are not passed to functions so you can not access "y" in def
pnv(x):
when call pnv(y).
Not sure how to simplify print(f"{x = }") further.
It is still better than print('x', x) as it is less error prone.
…On Sat, 7 Feb 2026 at 13:46, zurabksmlp ***@***.***> wrote:
*zurabksmlp* left a comment (SMLP-Systems/smlp#44)
<#44 (comment)>
Thanks Konstantin, it is a good idea but still requires typing extra
characters like f" {} " and is not significantly quicker. but it is a
good idea because maybe one can use *kwargs for that purpose.
If I simply define:
def pnv(x):
print(f"x = {x}")
y = 7
pnv(y)
then x = 7 is printed instead of y = 7.
<
https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
Virus-free.www.avast.com
<
https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
On Sat, Feb 7, 2026 at 3:30 PM konstantin-korovin ***@***.***>
wrote:
> *konstantin-korovin* left a comment (SMLP-Systems/smlp#44)
> <#44 (comment)>
> To print name and value you can use
>
> print(f"{var_name = }")
>
>
>
>
https://stackoverflow.com/questions/32000934/print-a-variables-name-and-value/57225950#57225950
>
>
> foo = 1
> bar = 2
>
> print(f"{foo = } {bar =}")
>
> produces:
>
> foo = 1 bar =2
>
>
> On Sat, 7 Feb 2026 at 13:04, zurabksmlp ***@***.***> wrote:
>
> > *zurabksmlp* left a comment (SMLP-Systems/smlp#44)
> > <#44 (comment)>
> > By the way , pnv() was a function in EVA that would print the name and
> the
> > value of a variable (in R language).
> > In Python, I use print('x', x), with pnv() it would be pnv(x).
> >
> > I remember I tried to write such a function in Python since it is very
> > handy, but I could not do it.
> > If you know how to do it, let me know.
> >
> > Zurab
> >
> > <
> >
>
https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
>
> >
> > Virus-free.www.avast.com
> > <
> >
>
https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
>
> >
> > <#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
> >
> > On Sat, Feb 7, 2026 at 3:00 PM Zurab Khasidashvili <
> > ***@***.***> wrote:
> >
> > > In most cases, I kept the commented lines because they provide
> > alternative
> > > implementation and I was not sure which implementation is best. So
> these
> > > lines are a reminder like the TODO comments that a revision might be
> > > relevant. You can see such commented out lines in many places, even
> > > functions like
> > >
> > > # equality
> > > @conditional_cache ***@***.***
> > > def smlp_eq(self, term1:smlp.term2, term2:smlp.term2):
> > > res1 = op.eq(term1, term2)
> > > #res2 = term1 == term2
> > > #assert res1 == res2
> > > return res1
> > >
> > > Here you see an alternative implementation and sanity check that is
> > > commented out. I am not sure specifically for these functions, but
> from
> > > what I remember using different implementations did affect
performance
> > of
> > > some of the tests.
> > >
> > > Yes, in some cases some commented out code can be safely removed
such
> as
> > > in the case you have pointed out (that variable ft is never used)
but
> it
> > > was not my intention to make a full cleanup.
> > >
> > > Zurab
> > >
> > >
> > > <
> >
>
https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
>
> >
> > > Virus-free.www.avast.com
> > > <
> >
>
https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
>
> >
> > > <#m_1703351304392304679_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
> > >
> > > On Sat, Feb 7, 2026 at 2:45 PM Franz Brauße ***@***.***>
> > > wrote:
> > >
> > >> ***@***.**** commented on this pull request.
> > >>
> > >> Nice PR, looks good to me, thanks. Just a few questions:
> > >> ------------------------------
> > >>
> > >> In src/smlp_py/smlp_precisions.py
> > >> <
#44 (comment)>:
>
> > >>
> > >> > + #true_pred_df = data.frame(true= bin_true_vec,
pred=bin_pred_vec)
> > >> #kappa2_res = kappa2(true_pred_df, "unweighted");
> > >> #kappa2_res = kappa2(true_pred_df, "squared");
> > >> - #cohen_kappa = kappa2_res$value; #pnv(cohen_kappa);
> > >> + #cohen_kappa = kappa2_res$value
> > >> #true_pred_categ_df = data.frame(true=factor(bin_true_vec,
> > levels=c(0,1)),
> > >> - # pred=factor(bin_pred_vec, levels=c(0,1)));
> pnv(true_pred_categ_df);
> > >> + # pred=factor(bin_pred_vec, levels=c(0,1)))
> > >>
> > >> Do we still need this commented code?
> > >> ------------------------------
> > >>
> > >> In src/smlp_py/smlp_precisions.py
> > >> <
#44 (comment)>:
>
> > >>
> > >> > + #pos_expectation =
> (predicted_negative/samples_count)*true_negative
> > >> + #neg_expectation = (predicted_positive/samples_count)*TP
> > >>
> > >> Same question: do we still need this commented code?
> > >> ------------------------------
> > >>
> > >> In src/smlp_py/smlp_precisions.py
> > >> <
#44 (comment)>:
>
> > >>
> > >> > + #pos.scores = pos_prob_vec[bin_true_vec_pos]
> > >> + #neg.scores = pos_prob_vec[bin_true_vec_neg]
> > >>
> > >> And again: do we need this?
> > >> ------------------------------
> > >>
> > >> In src/smlp_py/smlp_query.py
> > >> <
#44 (comment)>:
>
> > >>
> > >> > if query is not None:
> > >> solver.add(query)
> > >> res = self._modelTermsInst.smlp_solver_check(solver,
> > 'witness_consistency')
> > >> - #res = solver.check(); #print('res', res)
> > >> + #res = solver.check()
> > >>
> > >> Let's remove this commented line as well.
> > >> ------------------------------
> > >>
> > >> In src/smlp_py/smlp_subgroups.py
> > >> <
#44 (comment)>:
>
> > >>
> > >> > else:
> > >> - #ft = feat_df[rng_tuple['name']]; #print('ft\n', ft);
> > print(rng_tuple['hi'], rng_tuple['lo'])
> > >> - #print(rng_tuple); print(rng_tuple$hi); print(rng_tuple$lo)
> > >> + #ft = feat_df[rng_tuple['name']]
> > >>
> > >> I don't think ft is used anywhere, so this commented line should be
> > safe
> > >> to remove as well.
> > >>
> > >> —
> > >> Reply to this email directly, view it on GitHub
> > >> <
> >
>
#44 (review)>,
>
> >
> > >> or unsubscribe
> > >> <
> >
>
https://github.com/notifications/unsubscribe-auth/BPWPDL7LH3MKPXOCKGLPOVT4KXM45AVCNFSM6AAAAACUKFRUUSVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZTONRWHE3DGNBWGE>
>
> >
> > >> .
> > >> You are receiving this because you authored the thread.Message ID:
> > >> ***@***.***>
> > >>
> > >
> >
> > —
> > Reply to this email directly, view it on GitHub
> > <#44 (comment)>,
> > or unsubscribe
> > <
>
https://github.com/notifications/unsubscribe-auth/AIVYHTJ4WB7BKPQCXPT3QIL4KXPF7AVCNFSM6AAAAACUKFRUUSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTQNRUGQ4DKMJWGA>
>
> > .
> > You are receiving this because you are subscribed to this
thread.Message
> > ID: ***@***.***>
> >
>
> —
> Reply to this email directly, view it on GitHub
> <#44 (comment)>,
> or unsubscribe
> <
https://github.com/notifications/unsubscribe-auth/BPWPDL7EVLQM5OFHLMXFXTL4KXSFXAVCNFSM6AAAAACUKFRUUSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTQNRUGUYTEMJSGM>
> .
> You are receiving this because you authored the thread.Message ID:
> ***@***.***>
>
—
Reply to this email directly, view it on GitHub
<#44 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AIVYHTMR3VIXXBDG5CPGLCD4KXUD3AVCNFSM6AAAAACUKFRUUSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTQNRUGUZTCNZTGI>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
OK, so there were no conflicts when rebasing, good. Please do |
|
Regression passed.
|
I'm fine with that change, don't care about the graphical tool default settings. Eventually, those should go away and get replaced with the system standard, e.g., xdg-open or similar. |
Or, alternatively, these settings could become part of a |
|
I have run:
(venv_3.12.3) ***@***.***:~/smlp/repo/smlp/src$ git push -f
Everything up-to-date
<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
Virus-free.www.avast.com
<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
…On Sat, Feb 7, 2026 at 4:28 PM Franz Brauße ***@***.***> wrote:
*fbrausse* left a comment (SMLP-Systems/smlp#44)
<#44 (comment)>
replaced with the system standard
Or, alternatively, these settings could become part of a ~/.smlprc or
similar local config file. No need to have them hardcoded.
—
Reply to this email directly, view it on GitHub
<#44 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/BPWPDLYQVTXMVAVIY76BAPT4KXZCPAVCNFSM6AAAAACUKFRUUSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTQNRUGYYDINRWGM>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
|
@zurabksmlp No, that didn't work, as you can easily check on the Website: #44 Please run the same sequence of commands with an up-to-date master branch. |
fbrausse
left a comment
There was a problem hiding this comment.
Merging master into this branch left two commented debug prints. Due to this merge, I recommend re-running the regression suite.
|
I do not mind removing these two print statements, but is it worth it?
Because I will need to again create a PR for file-cleanup2? And Dmitry
will need to approve again?
<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
Virus-free.www.avast.com
<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
…On Sun, Feb 8, 2026 at 12:39 PM Franz Brauße ***@***.***> wrote:
***@***.**** commented on this pull request.
Merging master into this branch left two commented debug prints. Due to
this merge, I recommend re-running the regression suite.
------------------------------
In src/smlp_py/smlp_optimize.py
<#44 (comment)>:
> @@ -393,8 +393,13 @@ def optimize_single_objective_eager(self, model_full_term_dict:dict, objv_name:s
# compute and return max value of l_stab within P
assert len(P) > 0
- l_res = max([tup[3] for tup in P_eager])
- assert l_res == P[-1]['threshold_lo_scaled']
+ #print('P', P)
Let's remove this commented print statement as well.
------------------------------
In src/smlp_py/smlp_optimize.py
<#44 (comment)>:
> @@ -393,8 +393,13 @@ def optimize_single_objective_eager(self, model_full_term_dict:dict, objv_name:s
# compute and return max value of l_stab within P
assert len(P) > 0
- l_res = max([tup[3] for tup in P_eager])
- assert l_res == P[-1]['threshold_lo_scaled']
+ #print('P', P)
+ l_res = max([tup[3] for tup in P_eager]); #print('l_res', l_res, 'threshold_lo', P[-1]['threshold_lo'])
+ if scale_objectives or objv_bounds is None:
+ assert l_res == P[-1]['threshold_lo_scaled']
+ else:
+ assert l_res == P[-1]['threshold_lo']
+ #print('optimize_single_objective_eager and with l_res', l_res, flush=True)
And this one, please.
—
Reply to this email directly, view it on GitHub
<#44 (review)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/BPWPDLZYMZZOWC3UR5HBNHT4K4G7VAVCNFSM6AAAAACUKFRUUSVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZTONRZGYYTSMZWGY>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Yes, it is worth removing those two lines in this PR. Noone has approved it, yet, and running the regression suite should be done again anyway since the master merge did result in semantic changes, no? You can just add a commit to the existing |
…t line in smlp_subgroups.py
|
OK, done now.
Three prints removed from smlp_optimize.py and one commented out line in
smlp_subgroups.py (based on your earlier feedback).
<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
Virus-free.www.avast.com
<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
…On Sun, Feb 8, 2026 at 7:50 PM Franz Brauße ***@***.***> wrote:
*fbrausse* left a comment (SMLP-Systems/smlp#44)
<#44 (comment)>
I do not mind removing these two print statements, but is it worth it?
Because I will need to again create a PR for file-cleanup2? And Dmitry
will need to approve again?
Yes, it is worth removing those two lines *in this PR*. Noone has
approved it, yet, and running the regression suite should be done again
anyway since the master merge did result in semantic changes, no?
You can just add a commit to the existing file-cleanup2 branch and it
will be reflected in this PR. Just switch over to that branch, make sure it
is in sync with the remote one on Github, add a commit that removes those
two lines and push it back.
—
Reply to this email directly, view it on GitHub
<#44 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/BPWPDL2EHIMKHQWOGCOLJNL4K5ZNNAVCNFSM6AAAAACUKFRUUSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTQNRXG4ZTQOBZGQ>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
|
Many thanks, @zurabksmlp! I'll run regressions locally again. |
This PR contains repository and file cleanup -- some of the unused files got removed and commented-out print statements (and occasionally other commented-out code) has been remoted in files at repo/smlp/src/smlp_py directory.