Showing posts with label Bugs. Show all posts
Showing posts with label Bugs. Show all posts

Thursday, February 09, 2017

Diary: weights + Lisp reader issues + trim & style

Consider a hulking biker, tattoos and leotard, bench-pressing some massive barbell.

Alongside him, place that irritatingly-cheerful hunk Dr Chris van Tulleken, raising and lowering some wimpy baby dumbbells.

Pretending to be exhausted. Not this stagey picture below.



It was all in aid of this study (in the latest series of "Trust Me, I'm a Doctor").
"The study split 49 weight trainers into two groups and started them on a 12-week weight training programme. For each participant, they calculated their ‘one-repetition maximum’ or 1RM – that’s the heaviest weight they can lift.

"They then split the study into two groups, one group lifting 30-50% of their 1RM and the other group lifting 75-90%. The key thing was that each group lifted their weights to ‘volitional failure’ – in other words, they lifted until they couldn’t lift any more.

‘Failure’ will happen to anyone and everyone, however strong, if they do enough repetitions. So the group lifting the lighter weights did a larger number of reps (20-25) than the group lifting the heavier weight (8-12).

"The theory behind muscle failure is to do with ‘motor units.’ Motor units are bundles of muscle fibres controlled by a nerve. When you lift a weight, motor units will be required to contract the muscle. With each lift, some motor units will get fatigued, so additional motor units need to be used to do the next lift. Sooner or later you get to a point where all your available motor units have been exhausted – that’s what causes your muscles to fail.

"In the McMaster study, the results showed that despite lifting different weights, both groups showed the same increase in strength and muscle growth. In other words, doing heavy weights with fewer reps or lighter weights with more reps made no difference. These results agreed with earlier research conducted by the same group.

"So what does that mean for the rest of us? Well, it means that you can get results lifting heavy weights OR lighter weights, so long as you’re pushing your muscles to work harder than they normally do. You don’t always need to lift to failure to get results – but your muscles need to be ‘overloaded’ compared to your normal day to day life. Strength and conditioning coach Richard Blagrove from St. Mary’s University, Twickenham, suggests that on a scale of 1 to 10, where 10 is repetition failure, lifting to 7 or 8 is about right.

"If your muscles are feeling that overload once a week, your body will adapt and get stronger. If you want to continue to get stronger, you will need to constantly re-assess and progress your weight or rep level, to make sure you are always pushing your muscles beyond their comfort zone. If your weight training feels easy, it probably isn’t doing anything for you.

"You can get results using weights machines or free weights. Free weights also force you to use stabiliser muscles meaning you use more energy, and your joints move in their most natural way. But it’s important to lift correctly, so as soon as your “form” starts to go, you should probably stop. If you DO want to push yourself to failure, weight machines might be the safest place to do it. If you lift to failure with free-weights you need a partner who can relieve you of the weight when you can no longer lift it."
In a nutshell, don't go with "go heavy or go home!".

Do enough reps so that the last three are 'difficult'. Obviously you need enough weight so that you can get there within, say, 8-15 reps.

---

While I was watching our recording of "Trust Me, ..." my subconscious was whirring furiously. This afternoon I had painstakingly edited 43 rules for my Eliza program, which I'm reconstructing. The program works! But the rule set:
(defparameter +eliza-rules-extended+  '(.. stuff .. ))
refused to compile: weird and incomprehensible error messages complaining of 'invalid traits'. We're meant to be AI-advancing daily, but our development environments haven't the first clue.

My epiphany was that a rule which said something like:
(Why don't you like your mother?)
is going to hit a major problem with that quote character.

I rushed upstairs and deleted all the quotes from don't, doesn't, it's .. and everything loaded properly. Tomorrow I'll test it thoroughly and maybe post the code.

That should thrill you, dear reader.

---

As you know, my first target emulation is going to be the cat. Clare, who had to suffer through a tedious explanation of my afternoon difficulties, suggested that I should be designing a chatbot for the elderly. I'm to data-fill it with small talk about family, friends and neighbours (and pets?).

I suspect there's a market for that, and I'm not completely convinced that a state-of-the-art artificial neural net is required to implement it either.

But here to the contrary is Google's view:
"A simple strategy to build lightweight conversational models might be to create a small dictionary of common rules (input → reply mappings) on the device and use a naive look-up strategy at inference time.

This can work for simple prediction tasks involving a small set of classes using a handful of features (such as binary sentiment classification from text, e.g. “I love this movie” conveys a positive sentiment whereas the sentence “The acting was horrible” is negative).

But, it does not scale to complex natural language tasks involving rich vocabularies and the wide language variability observed in chat messages."
---

The diary would not be complete without observing that Clare had her hair done today.


I did notice.

Friday, January 20, 2017

Programming is so .. arid

Helena Cronin wrote:
"Women on average have a strong preference for working with people - hence the nurses and teachers; and, compared to men, they care more about family and relationships and have broader interests and priorities—hence little appeal in becoming CEOs. Men have far more interest in "things" - hence the engineers ... "
I'm sitting here looking at a short recursive function which returns a tree whose nodes are themselves a complicated data-type (Atom-list x Nat x Nat) and I'm trying to do minimax on it. The Lispworks 'Listener' has replaced the Atom lists with hash signs (why?) and the arithmetic min function complains it's getting something weird rather than Real - and has thrown me into the debugger.

Why?

The code looks good, although there are so many good-practice projector and constructor functions, cluttering the text.

I sit in frustration, trying to visualise the unwrapping of the computation as the nested mutually-recursive functions execute their combined paths to disaster. Part of me wants to chuck this code away; another part muses that this would mean I was getting even more stupid in my old age.

I review the psychological characteristics required for successful programming.
  • An ability to mentally visualise complex and abstract structures - (heavily g-loaded)
  • A minute attention to detail - the smallest typos kill you
  • Obsessional perseverance when nothing goes right and time-wasting options beckon.
If ever an occupation required what Simon Baron-Cohen calls the 'systemizing brain', this is it.

---

Update: (Twenty minutes later).

OK, so it was a type clash. I forgot to update a previous sub-function. Needed to add some projectors. So now I have a result.

Shame it's not the one I actually need ...

---

Some print-journalism stays with you. I regularly recall a right-on female commentator on The Times using her column to weigh in on gender equality in programming. After some shocking statistics she recounts how she asked her daughter if she had considered becoming a programmer. Her daughter looks at her as if she is mad: "Why would I want to do anything as boring as that?"

The daughter's mother is not of course a programmer. She's an opinion-piece journalist, a job where you get to meet and socialise with important people and then write lots of stuff of interest to your like-minded pals.

*Sigh*.

---

In case it isn't obvious, I know there are good female programmers. I know there are good female physicists (see here). It's just .. we're talking distributions here - you know, bell-shaped curves? - and the male-female means are noticeably different.

Strive for equality of opportunity; do not expect equality of outcome.