Monkeys on Typewriters
DALL·E Monkeys on Typewriters, set in a classical library, illustrates the timeless concept of generating complex work through seemingly random effort

Monkeys on Typewriters

AI will take your job - AI will make it easier until it does - AI in Python and C++ using Copilot - AI does not know the difference

If you've read any of the articles or tried the examples in the repository from the Python geotechTools on GitHub series, you've already been exposed to Python code written by AI. Over the last year, many entry barriers have fallen silently, and the quality of the experience came as a surprise to me when I took the dive (shoutout to my colleague James who told me to try GitHub Copilot last year).

My coffee-roasting, coding and gadget-enthusiast colleague, who told me to try GitHub Copilot last year (DALL·E)

The rapid advancement of Artificial Intelligence (AI) poses a significant threat to traditional job structures due to its ability to perform tasks with greater efficiency and accuracy than humans. AI excels in areas such as pattern recognition, data analysis, and executing repetitive tasks, making it a cost-effective solution for employers in industries ... blah blah blah. This and four more paragraphs were obviously written by ChatGPT4. Or you could read Will AI take my job? - hopefully written by a human (Not that it makes any difference, right?). Erik Ronald (coincidentally today) had some valid points on AI in mining software. ABC News Australia raised it yesterday: Heard AI is coming for your job?

If you've been browsing the articles for the fun of it but still think coding and that stuff is for the younger generation, and you're confident your proficiency with Excel is all you need ... I guess you're retiring soon anyway, right?

GitHub Copilot

GitHub Copilot is an AI tool developed by GitHub and OpenAI (fully and partially owned by Microsoft, respectively). It plugs (after forking out $10 US/month) into your integrated development environments (IDEs), such as Visual Studio, Visual Studio Code, Neovim and JetBrains. It seamlessly works in the background, interpreting lines above and below your cursor position and uses all files you currently have open as context.

It will prompt (light grey) the suggested code, easily accepted by pressing 'tab', (with up to nine alternatives, pressing 'alt-.'). An example from Principal Stress Transformations:

Co-pilot suggested code (grey)

Now this comes in handy and makes coding faster, a very real benefit for repetitive tasks. The ability to predict patterns is already quite intriguing:

Copilot guessing (predicting) the pattern. Or it saw it somewhere.

Now this next step goes further, but I can see the influence of other code I wrote that it saw in my repository:

Copilot stealing my ideas from other snippets

For this part of the code where I keep listed headers in xyzData in assigned positions (in particular x,y,z are 0,1,2 for practical aspects) I had a vague idea where I was going when I typed the first few lines and I was impressed with the correct suggestion:

Adding code with the correct intent taken from the comment line

Pushing the clever predictions further, the Principal Stress Transformations feature five lines that do the intended job, except I don't want [::-1] as the first principal stress S1 should be the lowest value (negative stress is compressive).

getPrincipals predicted by Copilot

Microsoft Edge also features a Bing Copilot "Your everyday AI companion", recently featured in a Super Bowl ad, that can reply to code requests:

Using Bing/Copilot in Microsoft Edge for the rotation matrix

One of the most surprising examples I have seen so far is in our libraries to work with numerical simulation files. Here, output from a model created in StopeX is packaged into an Abaqus input file. At this point, we're writing the SIMULIA Abaqus USER MATERIAL card with the parameters for the IUCM user subroutine. The prompt has the correct syntax for the Abaqus Input file (*.inp) elastic material card and parameters:

Copilot knows the SIMULIA Abaqus *ELASTIC material card correctly

So "*MATERIAL" - correct, "*DENSITY"- correct, "*ELASTIC"- correct, with parameters, and no "*DEPVAR" (no additional internal state variables that are needed for the user subroutine) - correct. There was no template for this in the code or files I was writing, and where this knowledge came from still eludes me.

One more impressive application example: Cavroc's IUCM model prides itself in "a detailed and transparent description of all the model’s components". In my upcoming talk at the Eastern Australian Ground Control Group, I wanted to support this with a slide showing a snippet of the actual Abaqus implementation. Do I show some code (real that I have written)? Yes. Does it give away IP? No. Why?

Can you turn the equations in the image into C++ code?
IUCM C++ code snippet from a screenshot of the pdf of

I love the confident opening with "Certainly! ... " and appreciate the "Remember to replace the /* initial value */ comments with actual values based on your specific problem. If you have any further questions or need additional assistance, feel free to ask! ??"

My army of robots according to DALL·E

So, I can put my feet up and let the robots code ...

Monkeys on Typewriters
DALL·E Monkeys on Typewriters, set in a classical library, illustrates the timeless concept of generating complex work through seemingly random effort

Now, the caveat ... just as much as self-driving cars will be delayed if they swerve for the teddy bear and hit the pram, AI seems to know what it is doing until it doesn't. As much as DALL·E image generation (thanks to Marcos Jacinto for valuable suggestions and inspiration from his Python article) has some bizarre outcomes (above robots came from a prompt that included my 'middle-aged, slightly overweight, thinning short hair' self-assessment for the fun of it), so is the suggested code plagued with flaws and misinterpretations. (Also, I thought I'd share the monkey image that was cropped at the title in its full magnificence at this point).

Examples include wrong indexing and assuming properties of libraries that do not exist (just because Abaqus odbAccess features array objects does not mean these have sum methods defined like numpy arrays). Copilot also seems to learn from my mistakes and repeat them. If you know what you're doing you can spot these problems easily. If not there's no hope of success.

Bottom Line
Everyone pointing their pencil to the screen, including an impossibly tall man in the corner (DALL·E)

A lot of us are already working faster and more productively. In particular when it comes to insights from data. I'm using my own Python geotechTools on a daily basis, and they save me a lot of time when it comes to analysing and interpreting data. If you look at tools like JetBrains DataSpell IDE that combine elements of coding with the interactive ways you'd find in Power BI (or Excel pivot tables if you insist), you'll find another great example of the step change happening.

Please share your thoughts and stories on the prevalence of AI and emerging copilots everywhere. Have you used them? Did the outcomes meet expectations?

References

Vakili, A. 2016, An improved unified constitutive model for rock material and guidelines for its application in numerical modelling, Computers and Geotechnics, Volume 80, December 2016, Pages 261-282, ISSN 0266-352X, https://dx.doi.org/10.1016/j.compgeo.2016.08.020


Marcos Jacinto

Data GeoScientist at Geowellex ? Geologist ? M.Sc. in Geodynamics and Geophysics ? MBA in Cloud Engineering & Archicture

1 年

Great images! Thanks for mentioning me, Stephan!

Abouzar Vakili

Principal Geotechnical Engineer @ Mining One Consultants | MAusIMM CP(Geotech) RPEQ Founder @ Cavroc

1 年

I am truly speechless ?? ????

Erik Ronald

Principal Consultant | Mining Geology | Mineral Resources | Exploration

1 年

Good stuff Stephan!

Nico Viljoen

Chief Geotech - Mining enthusiast and experienced in underground mining

1 年

Thank you for sharing Stephan. I will definitely give Copilot a try

要查看或添加评论,请登录

Stephan ARNDT的更多文章

  • EAGCG Recap: IUCM & Abaqus

    EAGCG Recap: IUCM & Abaqus

    This year's EAGCG workshop was spectacular. There was an extensive line-up of speakers and sponsors, about 145…

  • Slope Stability (Part 3): Pore Pressure

    Slope Stability (Part 3): Pore Pressure

    Why is pore pressure important for slope stability? Part 1 of the Slope Stability articles outlined the importance of…

    6 条评论
  • Slope Stability - Shear Strength Reduction Method (Part 2)

    Slope Stability - Shear Strength Reduction Method (Part 2)

    "It has always been done this way" The five monkeys experiment. I doubt there's reliable information to confirm this…

    4 条评论
  • Slope Stability - Shear Strength Reduction Method (Part 1)

    Slope Stability - Shear Strength Reduction Method (Part 1)

    Ok, up front: There's nothing new here; you'll have to wait for Part 2. There, I intend to present some challenging…

    9 条评论
  • Principal Stress Transformations

    Principal Stress Transformations

    In this article, we're going off on a tangent from the theme of block models, kdTrees and grid data in the GitHub…

    6 条评论
  • Don't stress, use Python

    Don't stress, use Python

    Any discussion about in-situ stress for an underground mine can turn into a heated argument quickly - just from my…

    2 条评论
  • Python gridData in geotechTools

    Python gridData in geotechTools

    Traditionally, there are endless applications for arranging points in a regular grid. In practical terms, this means we…

    2 条评论
  • geotechTools mapData (kdTree)

    geotechTools mapData (kdTree)

    Introducing the Python geotechTools last week (and the repository on GitHub), the example did little more than robustly…

    2 条评论
  • Python geotechTools on GitHub

    Python geotechTools on GitHub

    So, you're still using Excel for geotech data. Here are some examples of using Python and libraries like Numpy to…

    37 条评论
  • 2024: Are you still using Excel (for Geotech data)?

    2024: Are you still using Excel (for Geotech data)?

    Spoiler alert … for most of you, the answer is probably ‘yes’. A recent poll in Mining Geomechanics showed these…

    18 条评论

社区洞察

其他会员也浏览了